js判断是关闭窗口还是刷新窗口

 <script type="text/javascript">
		    window.onbeforeunload=function window.onbeforeunload(){
			    if (document.body.clientWidth-event.clientX<21||event.altKey||event.ctrlKey){
			         alert("close");
			    }else{
			          window.event.returnValue="";
			          alert("refrash");
			          return false;
			     }
			}
		</script>

你可能感兴趣的:(js)