开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜