相关疑难解决方法(0)

setAttribute不适用于IE上的'style'属性

我正在将一段为Firefox编写的JS代码移植到Internet Explorer中.我遇到了使用setAttribute在Firefox上工作的方法更改元素样式的问题.

button.setAttribute('style', 'float: right;');
Run Code Online (Sandbox Code Playgroud)

我尝试设置按钮的样式成员,它也不起作用.这是设置onclick事件处理程序的解决方案.

button.style = 'float: right;';
Run Code Online (Sandbox Code Playgroud)

首先,我想知道上述问题的解决方案,
其次是浏览器之间存在这些差异的维护列表吗?

html javascript internet-explorer

22
推荐指数
3
解决办法
4万
查看次数

标签 统计

html ×1

internet-explorer ×1

javascript ×1