小编Dan*_* W.的帖子

如何让firefox使用style ['attribute-name'] =设置样式属性?

在此示例中, Chrome将背景设置为红色,firefox和IE则不设置.

试:

document.getElementById("firefoxDiv").style['backgroundColor'] = "Red";
Run Code Online (Sandbox Code Playgroud)

document.getElementById("firefoxDiv").style['background-color'] = "Red";
Run Code Online (Sandbox Code Playgroud)

我宁愿能够使用外部CSS中使用的相同语法 background-color与内联使用javascript.style.backgroundColor =

谢谢你的帮助!

注意:不要 jQuery.

javascript css firefox

4
推荐指数
1
解决办法
2027
查看次数

标签 统计

css ×1

firefox ×1

javascript ×1