關閉視窗出現警告

關閉視窗出現警告

 

this.Page.Response.Write("<script language=\"javascript\">\n");
            this.Page.Response.Write("if(confirm('請確認是否已存檔 若沒有請按『取消』。若已存檔 請按『確定』退出此單!')){window.location.href='PlmList.aspx?userid="" + Label1.Text + "';});
            this.Page.Response.Write("</script>");

----2
  <script>    
  function   window.onbeforeunload()    
  {    
  if(event.clientX>document.body.clientWidth&&event.clientY<0||event.altKey)    
  {    
  window.event.returnValue="確定關閉嗎";    
  }
else    
  {    
      alert("你選擇不退出");    
  }
    
  }
    
  </script>