我不明白为什么属性未设置为变量 为什么颜色没有改变?
这是代码:
var text = document.createElement('h2');
text.textContent = 'TEXT';
text.setAttribute("style", "color: red, margin-top:5px");
document.body.appendChild(text);
更改color: red, margin-top:5px
为color: red; margin-top:5px
var text = document.createElement('h2');
text.textContent = 'TEXT';
text.setAttribute("style", "color: red; margin-top:5px");
document.body.appendChild(text);
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句