<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <script> function myblur () { alert("1. Leave"); } function bindEvent(func){ myblur = func; } function myonclick() { bindEvent(function(){ alert("Oh my God! The myblur method is covered!"); }); } </script> </head> <body> <input type="text" onblur="myblur()" value="Select the cursor and then leave the cursor and call itmyblur()method"/> <input type="button" onclick="myonclick()" value="covermyblur()" /> Note:covermyblur()back,再次光标选中输入框然back再离开 </body> </html>
Purpose: Improve the perfect call method.
If you have an editor that provides some cursor leaving events, etc., it is best to use this method to operate, because when others use your editor, you may need to use the event method provided by the editor to handle some things, and some events need to be rewritten according to special requirements. Therefore, if this happens, it is necessary to provide the method of rewriting the event provided by the editor!