0
任何想法爲什麼preSaveAction只是重定向。它應該添加一條記錄,然後將用戶帶到調查的謝謝頁面。PreSaveAction未觸發
<script src="http://ajax.aspnetcdn.com/ajax/jquery/jquery-1.6.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
// old handler:
var oldHandler = function() {
if (!PreSaveItem()) return false;
WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("ctl00_m_g_4bde870c_7fcd_4f61_b446_e287f846faf3_ctl00_toolBarTbltop_RightRptControls_ctl01_ctl00_diidIOSaveItem", "", true, "", "", false, true));
};
// remove old and add new handler:
var newHandler = function() {
if (!PreSaveItem()) return false;
WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("ctl00_m_g_4bde870c_7fcd_4f61_b446_e287f846faf3_ctl00_toolBarTbltop_RightRptControls_ctl01_ctl00_diidIOSaveItem", "", true, "", "", false, true));
window.location.replace("/surveys/Pages/ThankYou.aspx");
return true;
};
$("#ctl00_m_g_4bde870c_7fcd_4f61_b446_e287f846faf3_ctl00_toolBarTbltop_RightRptControls_ctl01_ctl00_diidIOSaveItem").unbind('click', oldHandler).click(newHandler);
});
</script>
在jquery-href開頭的單引號只是一個錯字嗎? – Andreas
...爲什麼在javascript函數中有一個輸入按鈕?你確定你的代碼運行? –
我把錯字拿出來了。我認爲代碼運行是因爲我在最後添加了一個警報,並且它已經升級了。 –