JS Add/Remove events in IE and support DOM browsers are: attachevent (add event in IE), detachevent (delete event in IE), AddEventListener (add event in Dom browser), RemoveEventListener (Support for deletion events in the Dom browser).
For example, the first time you click on the black area when the pop-up warning, and remove the click event, that is, the second click of the time did not respond, the integration code is as follows:
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd "> <ptml xmlns=" http://www.w3.org/1999/xhtml "> <pead> <meta http-equiv=" Content-type "content=" text/html; charset=gb2312 "/> <title> Add Delete event </title> <script type=" Text/javascript "> var eventutil=new Object; Otarget: Target; Seventtype: event name; Funname: Event-triggered function name; Eventutil.addevent=function (otarget,seventtype,funname) {// document.getElementById ("DD"). attachevent if (otarget.addeventlistener) {//for DOM; Otarget.addeventlistener (Seventtype,funname, false); }else if (otarget.attachevent) {otarget.attachevent ("on" +seventtype,funname); }else{otarget["on" +seventtype]=funname; } }; Eventutil.removeevent=function (otarget,seventtype,funname) {//document.getelementbyid ("dd"). AttachEvent if ( Otarget.removeeventlistener) {//for DOM; Otarget.removeeventlistener (Seventtype,funname, false); }else if (otarget.detachevent) {Otarget.detaChevent ("on" +seventtype,funname); }else{otarget["on" +seventtype]=null; } }; function Removeclick () {Alert ("click"); var Odiv=document.getelementbyid ("Odiv"); odiv.style.cursor= "Auto"; Eventutil.removeevent (Odiv, "click", Removeclick); }//----Multiple functions are bound to the window.onload------//function Addloadevent (func) {var oldonload=window.onload; if (typeof window.onload!= "function") {Window.onload=func; }else{window.onload=function () {oldonload (); Func (); }} addloadevent (AddClick); function AddClick () {var Odiv=document.getelementbyid ("Odiv"); odiv.style.cursor= "Pointer"; Eventutil.addevent (Odiv, "click", Removeclick); </script> </pead> <body> <p> First click on the black area when the pop-up warning, and remove the click event, that is, the second click of the time did not respond to the </p> < Div id= "Odiv" > First point I warn you, the second time I ignore you! </div> </body> </ptml>
[Ctrl + A All SELECT Note: If the need to introduce external JS need to refresh to perform]