在这行代码上出现此错误:
document.getElementsByTagName("table")[0].style.setProperty("background-color", "#D19000", "important");
<小时/>
仅在 IE8 中,想想看,有人知道如何修复它吗?
最佳答案
对于旧版本的 Internet Explorer,您需要使用以下语法:
elem.style.backgroundColor = "#D19000";
elem.style.color = "red";
请注意,任何用连字符连接的属性都需要采用驼峰命名法。
关于javascript - IE8风格不支持setProperty方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58117039/