网页关闭时弹出确认取消对话框

<script language="javascript">
function UnLoadConfirm()
{
    if(event.clientX>document.body.clientWidth&&event.clientY<0||event.altKey){
        window.event.returnValue = "确定退出?";
    }
}
</script>

<body onbeforeunload="javascript:UnLoadConfirm();">
</body>

你可能感兴趣的:(JavaScript)