IE8中的Javascript错误:未实现 [英] Javascript error in IE8: Not implemented

查看:116
本文介绍了IE8中的Javascript错误:未实现的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这个让我很困惑,因为代码看起来完全无害。

This one really puzzles me, as the code looks completely harmless.

IE8停止脚本执行并显示一条消息:

IE8 halts script execution with a message:


未实现。 map.js行:66字符:5

Not implemented. map.js line:66 char:5

以下是代码中的剪辑:

63 if(data.map[x] !== undefined && data.map[x][y] !== undefined) {
64              
65   left = (x - data.dim.x_min)*32 + 30;
66   top = (data.dim.y_max - y)*32 + 30;
67
68  /* do stuff */
XX }

debug info:x:263 data.dim.x_min:263 y:172 data.dim.y_max:174

debug info: x:263 data.dim.x_min:263 y:172 data.dim.y_max:174

数据是从JQuery Ajax调用返回的对象。这适用于Firefox 3.0和3.5,safari 4.0.2,我在IE8中查看页面时才发现此错误。强制IE8进入IE7模式不会使错误消失。

Data is object returned from JQuery Ajax call. This works in Firefox 3.0 and 3.5, safari 4.0.2 and I've only found this error when viewing the page in IE8. Forcing IE8 into IE7 mode does not make the error go away.

我没有IE7可以调试,但我有一个测试人员说它不起作用在IE7中也是。

I don't have IE7 to debug with, but I got a tester saying that it doesn't work in IE7 either.

推荐答案

代码中使用的变量'top'是DispHTMLWindow2(最外层窗口对象)类型的对象,并且已被使用浏览器和导致冲突的因素,因为该对象不能成为赋值操作的目标。似乎Firefox和Safari忽略了这一点,而IE不允许脚本覆盖它。

The variable 'top' used in the code is an object of type DispHTMLWindow2 (outermost window object) and already in use by the browsers and that is causing the conflict, as that object cant be the target of the assignment operation. It seems that Firefox and Safari ignore this, while IE does not allow scripts to overwrite this.

解决方案:

1)声明top你正在使用它作为局部变量来定义它的使用范围。

1) Declare top you are using as local variable to define it's scope where it is used.

2)将变量重命名为不与之冲突的东西这个预定义的全局。

2) Rename the variable to something that doesn't conflict with this predefined global.

你不应该使用的其他变量名的描述

这篇关于IE8中的Javascript错误:未实现的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆