HTMLInstance.attachEvent onload

时间:2012-02-13 15:41:18

标签: javascript

以下代码适用于IE9但不适用于IE8

     HTMLInstance.attachEvent("onclick" , function() { } ); // work with IE8
     HTMLInstance.attachEvent("onload" , function() { } ); // does not work with IE8 but works with IE9

如何解决onlaod事件的问题?

1 个答案:

答案 0 :(得分:0)

IE 8中没有onload事件,因此您应该使用window.onloadwindow.body.onload

window.onload = function(){

}