1
我有一個aspx頁面。在頁面上我有一個javascript函數AJAX和onbeforeunload事件
window.onbeforeunload = confirmExit;
function confirmExit()
{
return "You have attempted to leave this page. If you have made any changes to the fields without clicking the Submit button, your changes will be lost. Are you sure you want to exit this page?";
}
這會在用戶離開頁面時執行。但是它也會在部分頁面回發上執行。如何檢查這是否是部分頁面回發並忽略它?
讓我舉一個例子。在aspx表單上我有一個控件。當我從這個控件中選擇一個選項時,會有一個部分回傳,並執行confirmExit()函數。我如何知道這是一個下拉選擇,而不是實際的導航離開頁面? –
user1247395
2012-04-24 18:17:05