<html>
<head>
</head>
<script language=javascript>
function window.onunload(){
// alert('这就是你要做的事,关闭网页之后做的!')
}
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("是刷新而非关闭");
}
}
function myunload()
{
if(event.clientX>document.body.clientWidth&&event.clientY<0||event.altKey)
{
window.event.returnValue = "关闭窗口";
}
else{
window.event.returnValue = "刷新窗口";
}
}
</script>
<body>
<form >
</form>
</body>
</html>
关闭按钮
最新推荐文章于 2021-03-25 15:34:38 发布