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