前臺aspx: 
<html xmlns="http://www.w3.org/1999/xhtml" > 
<head runat="server"> 
    <title>Untitled Page </title> 
    <script type="text/javascript"> 
        function Newswindows() 
        { 
            var retValue =window.showModalDialog("WebForm1.aspx","尺寸工時與工資","scrollbars=yes;resizable=yes;help=no;status=no;dialogHeight=500px;dialogwidth=430px;center=yes");  
            if(retValue=="refresh"){ 
                window.location.href =window.location.href ; 
            } 
        } 
    </script>    
    <script language ="javascript" type="text/javascript"> 
        function AlertbeforeUnload() 
        { 
            event.returnValue="尚未保存,\r請確認是否要關閉頁面?"; 
        } ; 
    </script> 
</head> 
<body onbeforeunload = "AlertbeforeUnload();"> 
    <form id="form1" runat="server"> 
    <div> 
        <asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" /> </div> 
    </form> 
</body> 
</html> 
後臺cs: 
protected void Button1_Click(object sender, EventArgs e) 
        { 
            if (!Page.ClientScript.IsStartupScriptRegistered("yins01")) 
                Page.ClientScript.RegisterStartupScript(this.GetType(), "yins01", " <script type='text/javascript'>Newswindows() </script>"); 
        } 當關閉時會彈出提示用戶要保存,當點擊按鈕彈出一個新頁面,但是在彈出新頁面的時候也彈出了這個提示, 
我想只在關閉時彈出提示詢問是否要保存,點擊其它按鈕則不彈出提示,怎么辦?