bind和unbind,pageX,pageY,.screenX, screenY是怎么用的
例 2.2(e.pageXscreenX.html)
马克- to-win:马克 java社区:防盗版实名手机尾号: 73203。
<html>
<head>
<script language="javascript" src="jquery.min.js"></script>
<script language="javascript">
$(function(){
/*马克-to-win:和原来一样,pageX指窗口里,screenX指屏幕,所以多了一个上面的菜单。*/
$("body").bind("click", fn1 = function(e){
var posPage = "(" + e.pageX + "," + e.pageY + ")";
var posScreen = "(" + e.screenX + "," + e.screenY + ")";
$("span").html("<br>Page: " + posPage + "<br>Screen: " + posScreen);
});
$("input[type=button]").click(function(){
$("body").unbind("click",fn1); //移除事件监听myFunc1
});
});
</script>
</head>
<body>
sgkls<br>
sfdgsdg<br>
gf<br>
fsdf<br>
fgdsf<br>
sdf<br>
sdfdsf<br>
sdfsd<br>
<input type="button" value="移除事件1">
<span></span>
</body>
</html>