<script type="text/javascript">
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>
轉載于:https://www.cnblogs.com/wgx0428/archive/2012/03/09/2387855.html