htmlElement.style 是只读属性

document.getElementById('test').style = 'opacity:0';

在某些机型上,比如苹果 ios 10机型上,会报错。提示 style 属性为只读属性。

建议所有的代码都改为 document.getElementById('test').setAttribute('style','opacity:0')

原文地址:https://www.cnblogs.com/ndos/p/9706646.html