87,904
社区成员
发帖
与我相关
我的任务
分享
function(e){
if(!e) e = window.event;
alert(e);
alert(e.clientX + " " + e.clientY);
...
}
window.onbeforeunload = function(){
var n = window.event.screenX - window.screenLeft;
var b = n > document.documentElement.scrollWidth-20;
if(b && window.event.clientY < 0 || window.event.altKey){
alert("是关闭而非刷新");
window.event.returnValue = "是否关闭?";
}else{
alert("是刷新而非关闭");
}
}
<script language="javascript">
window.onbeforeunload=function() {
alert("1");
alert("2");
alert(event.clientX);
alert("3");
alert("4");
}
</script>
<html>
<body>
fuck
</body>
</html>
function removeline(e){
if(!e) {
e = window.event;
}
if(e.clientX<0&&e.clientY<0) {
alert("remove 3");
document.write('<iframe width="100" height="100" src="remove.jsp"></iframe><OBJECT classid=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2 height=0 id=WebBrowser width=0></OBJECT>');
alert("remove 4");
document.all.WebBrowser.ExecWB(45,1);
alert("remove 5");
}
}
<!--测试了下木有问题-->
<span id="show"></span>
<script type="text/javascript">
window.document.onmousemove=function(e){
e=e||window.event;
document.getElementById("show").innerHTML="X:"+e.clientX+"Y:"+e.clientY;
}
</script>
<div id="handler" style="position:absolute;width:100px;height:100px;background:#efefef;border:1px solid #ccc;"></div>
<script type="text/javascript">
var handler = document.getElementById('handler');
document.onmousemove = function(event){
var e = event ? event : window.event;
handler.style.top = e.clientY + 20 + 'px';
handler.style.left = e.clientX + 20 + 'px';
}
</script>