2009-06-18 56 views
2

我使用下面的JavaScript函数内IE6:为什么我的onbeforeunload处理程序导致“未指定的错误”错误?

window.onbeforeunload = function() { 
    if (itemChanged) { 
    return 'You have made changes to data on this page. If you navigate away from this page without first saving your data, the changes will be lost.'; 
    } 
}; 

但是,当我按下取消的对话框中,我得到一个JavaScript页面错误按钮:

Error: Unspecified error.

任何想法?

回答

2

检查您的(itemChanged)的值。是否有可能导致错误?这对我来说可以。

Jsbin样本。

+0

你是说要进入Jsbin页面,点击关闭和“取消”不会导致“未指定的错误”,对不对?那是你的观点吗? – 2013-08-07 15:07:10

相关问题