用javascript实现添加<body>的事件句柄
想实现添加 <body> 的onblur事件 如下所示
<SCRIPT language=JavaScript>
//window.onblur= 'window_onblur() '
document.body.onblur= 'window_onblur() '
function window_onblur() {
alert( "blur ")
}
</SCRIPT>
怎么就没效果呀
------解决方案-------------------- <SCRIPT language= "JavaScript ">
//window.onblur= 'window_onblur() ';
document.body.onblur=function() {
alert( "blur ");
}
</SCRIPT>
------解决方案-------------------- <SCRIPT language=JavaScript>
//window.onblur= 'window_onblur() '
document.body.onblur=window_onblur
function window_onblur() {
alert( "blur ")
}
</SCRIPT>
如此也可.
------解决方案--------------------up!
------解决方案--------------------注意顺序!
------解决方案-------------------- <html>
<SCRIPT language=JavaScript>
function window_onblur() {
alert( "blur ")
}
window.onblur=window_onblur;
</SCRIPT>
<body >
test
</body>
</html>