<font face="Arial" style="background-color: #ffffff"><</font>html> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <script> function myblur () { alert("1、离开"); } function bindEvent(func){ myblur = func; } function myonclick() { bindEvent(function(){ alert("天啊!myblur方法被覆盖了!"); }); } </script> </head> <body> <input type="text" onblur="myblur()" value="光标选中然后光标离开会调用myblur()方法"/> <input type="button" onclick="myonclick()" value="覆盖myblur()" /> 注:覆盖myblur()后,再次光标选中输入框然后再离开 </body> </html>
Purpose: Improve the perfect calling method.
If you make an editor that provides some cursor leave events, etc., it is best to use this method to operate, because when others use your editor, you may need to use the event methods provided by the editor to handle some Some events need to be rewritten according to special requirements. Therefore, in this case, it is necessary to provide event methods that allow overriding of the event methods provided by the editor!