我正在开发一个 Windows 小工具。背景对象上有一个名为 addTextObject 的函数,它创建了我想要的对象,稍后我可以为其添加发光和阴影。但问题是我无法控制对象的位置。例如,如果我想将它附加到 div 或 span 或 td 中,则 appendChild 方法不起作用。我怎样才能解决这个问题?
var txtGlow = document.getElementById('imgBackground').addTextObject("test", "Verdana", 25, "Red", 50, 50);
txtGlow.opacity = 100;
txtGlow.addGlow("yellow", 50, 50);
var theDiv = document.getElementById('divx');
txtGlow.value = theDiv.innerText;
theDiv.appendChild(txtGlow);