<script type="text/javascript"> window.a = 0; var rv = "肯定要關閉嗎?"; window.onbeforeunload = function () { var isIE = document.all ? true : false; if (isIE) { var n = window.event.screenX - window.screenLeft; var b = n > document.documentElement.scrollWidth - 20; if (b && window.event.clientY < 0 || window.event.altKey) { //是關閉而非刷新 window.event.returnValue = rv; } } else { if (document.documentElement.scrollWidth != 0) { if (window.a != 1) { window.a = 0; return rv; } else { window.a = 0; } } else { window.a = 0; return rv; } } } </script>