开发者

Basic JavaScript crashes/hangs IE9, but not FF, Ch, or Op - "Not Implemented"

开发者 https://www.devze.com 2023-03-23 20:46 出处:网络
I get the following error: SCRIPT16385: Not implemented On the following line of code: document.getElementById(\"amtcase\").style = \"background-color: #FFFFFF;\";

I get the following error:

SCRIPT16385: Not implemented

On the following line of code:

document.getElementById("amtcase").style = "background-color: #FFFFFF;";

"amtcase" is a text field

This only occu开发者_运维问答rs on IE9, tested fine with Opera, Chrome, and FireFox.


In IE you can't assign the "style" attribute of a DOM node like that. You can do a couple of alternatives:

document.getElementById('amtcase').style.backgroundColor = '#FFFFFF';

or

document.getElementById('amtcase').style.cssText = 'background-color: #FFFFFF';


Do:

document.getElementById("amtcase").style["backgroundColor"] = "#FFFFFF";

or

document.getElementById("amtcase").style.backgroundColor = "#FFFFFF";
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号