1. <html>
2. <head>
3. <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
4. <script>
5. function myblur () {
6. alert("1、离开");
7. }
8. function bindEvent(func){
9. myblur = func;
10. }
11. function myonclick() {
12. bindEvent(function(){
13. alert("天啊!myblur方法被覆盖了!");
14. });
15. }
16. </script>
17. </head>
18.
19. <body>
20. <input type="text" onblur="myblur()" value="光标选中然后光标离开会调用myblur()方法"/>
21. <input type="button" onclick="myonclick()" value="覆盖myblur()" />
22. 注:覆盖myblur()后,再次光标选中输入框然后再离开
23. </body>
24. </html>