The simple binding time seems to be effective only when loading for the first time.
Document. getelementbyid ('yourhtmlelement'). onclick = Haha;
Function Haha (){
Alert ("Cleopatra ");
}
If the parameter is passed, it is a soy sauce.
Document. getelementbyid ("yourhtmlelement"). onclick = Haha ("your input ");
Function Haha (content ){
Alert (content );
}
This method will be executed once during the first loading and will not work.
For IE 6 (confirmed)
Document. getelementbyid ("yourhtmlelement"). attactevent /*(It should be attachevent, think8848 note) */("Onclick ",
New Function ("_ blackorwhite ('your input ');"));
Function _ blackorwhite (content ){
Alert (content );
}
Attactevent (Same as above, think8848 note) The method will not be executed when loading this statement. It is actually bound. It will only be executed during running.
For Mozilla
Document. getelementbyid ("yourhtmlelement"). addeventlistener ("onclick", _ blackorwhite, false );
Function _ blackorwhite (){
Alert ("Have you noticed any difference? ");
}
Note that parameter settings are not allowed for the key 1 event under Mozilla. If you pass parameters, the event will be executed during loading rather than when the response action occurs. Possible Solution: Mozilla can know who triggered this event, so that the parameter passed can be known by the event trigger through some means.