這次作業又發現IE出槌了,真煩。
IE8之前的版本似乎會對以下代碼輸出 [object]
document.getElementById("a_11").setAttribute("style","width:18px;");
document.write(document.getElementById("a_11").getAttribute("style"));
將 style 改成 styl 如下,就能正確輸出 width:18px;
document.getElementById("a_11").setAttribute("styl","width:18px;");
document.write(document.getElementById("a_11").getAttribute("styl"));
這造成我製作的網頁無法在IE8之前的版本更改背景。
找到解決方法了。20090607
document.getElementById("a_11").style.width="18px;"
document.write(document.getElementById("a_11").getAttribute("style"));
沒有留言:
張貼留言