Javascript 为什么我的onbeforeunload处理程序会导致;未指定错误“;错误?

Javascript 为什么我的onbeforeunload处理程序会导致;未指定错误“;错误?,javascript,internet-explorer-6,onbeforeunload,Javascript,Internet Explorer 6,Onbeforeunload,我在IE6中使用以下JavaScript函数: 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.'; } };

我在IE6中使用以下JavaScript函数:

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页面错误:

错误:未指定的错误

有什么想法吗?

检查您的(项目更改)值。是否可能是其他原因导致错误?这对我来说很好


示例。

您的意思是,转到Jsbin页面,单击“关闭”和“取消”不会导致“未指定的错误”,对吗?这是你的观点吗?