子表單重新整理父表單時,彈出討厭的對話方塊,“需要重新發送您以前提交的資訊”
解決方案,在子表單關閉時
代碼:
window.document.execCommand('Refresh');
父表單的Forms標記method="GET"
<form id="form1" runat="server" method="GET">
文章來自己Jquery彈出子表單時,重新整理父表單
ASP.NET整合fancybox彈出頁面執行個體講解
fancybox:http://fancybox.net/ 前台代碼:在ASPX頭部加入下列語句:<script src="../js/jquery-1.4.2.min.js" type="text/javascript"></script><script src="../js/jquery.mousewheel-3.0.4.pack.js" type="text/javascript"></script><script src="../js/jquery.fancybox-1.3.4.js" type="text/javascript"></script>接著寫入下列script語句:<script type="text/javascript">$(document).ready(function(){ $('a.newBtn').each(function(index) { $(this).fancybox({ 'width' : '95%', 'height' : '95%', 'type' : 'iframe', 'hideOnOverlayClick' : false, 'onCleanup' : function() { return confirm('Are you sure to close this dialog?All data will be lost if not save.');}, 'onClosed' : function() { window.location.href = 'index.aspx';} }); });});</script>a.newBtn對應控制項如下:<a class="newBtn" href="edit.aspx">Add New</a>這裡的edit.aspx中可以加入參數。如edit.aspx?id=1等。這樣點擊Add New後,edit.aspx頁面就會彈出來了。如何在彈出來的fancybox頁面上點擊Close按鈕關閉它?parent.$.fancybox.close();http://stackoverflow.com/questions/1829319/close-fancy-box-from-function-from-within-open-fancybox如何在彈出來的fancybox頁面上點擊Close按鈕重新整理父頁面?window.parent.document.execCommand('Refresh');如何在當前版面設定關閉fancybox頁面後重新整理此頁面?$('a#editCatalog').fancybox({ 'width': '80%', 'height': '80%', 'type': 'iframe', 'hideOnOverlayClick': false, 'onClosed': function() { window.document.execCommand('Refresh'); } }); 將refresh這句話寫在“onClosed”的好處就是在彈出頁面中,無論點擊“Close”按鈕,還是點擊右上方的“Close”表徵圖關閉彈出頁面,都會運行到onClosed這裡。經實驗,發現在IE下沒問題,在FF下就不行。修改代碼為:window.document.location.reload(true);即可。