以下代码按顺序1,2,3,4,5(使用当前版本的FF,Safari,Chrome进行测试)运行功能,但在IE8(我没有IE9)中它们以3,2运行,4,5,1?
是否有按IE提供的顺序运行它们的解决方案?
感谢。
function addEvent( obj, type, fn ){
if (obj.addEventListener){
obj.addEventListener( type, fn, false );
}
else if (obj.attachEvent){
obj["e"+type+fn] = fn;
obj[type+fn] = function(){ obj["e"+type+fn]( window.event ); }
obj.attachEvent( "on"+type, obj[type+fn] );
}
}
addEvent(window, 'load', function1);
addEvent(window, 'load', function2);
addEvent(window, 'load', function3);
addEvent(window, 'load', function4);
addEvent(window, 'load', function5);