/*
1. obj is equivalent to window
2 , type is equivalent to onload
3, fn is equivalent to anonymous function
*/
function addEvent( obj,type,fn ){
var saved = null; // The user saves the previous event
if( typeof obj[ "on" type ] == "function" ){
saved = obj[ "on" type ]; // The user saves the previous event
};
// Execute event
obj[ "on" type ] = function(){
if( saved ){
saved()
};
fn();
};
} ;
addEvent( window,"load",function(){
alert( "I am 尜尜1" );
});
addEvent( window,"load",function() {
alert( "I am 尜尜2" );
});
addEvent( window,"load",function(){
alert( "I am 尜尜3" );
});