解决 .setAttribute 添加JS或者CSS 在IE下不起作用.


   document.getElementById("divid").setAttribute("onmouseout", "javascript:this.style.backgroundColor='#fff'");
  
    上面这行代码在Firefox 下能正常运行,然后放在IE下却不能运行.因为在IE下这行代码没有生效

   给上面一行代码稍作修改就能使它兼容在IE和FF下.

   document.getElementById("divid").onmouseout = function(){                   
                document.getElementById("divid").style.backgroundColor = "#fff";
                }

posted @ 2008-04-25 10:50  Anson2020  阅读(1888)  评论(3)    收藏  举报