在IE8上,error: Object不支持这个属性或方法

时间:2023-01-21 19:19:48

I have jQuery for a WordPress theme I'm building. I've given up for now on testing IE6 and IE7 (layouting hell), and now I'm testing it using IE8. Every time I click on a prettyPhoto link OR a jQuery cycle link, JS gives out this error and fails to bring up the lightbox or move the slider. As usual his works fine in all the other browsers.

我有一个WordPress主题的jQuery。现在我已经放弃了对IE6和IE7的测试,现在我正在用IE8进行测试。每次我点击一个prettyPhoto链接或jQuery循环链接时,JS都会给出这个错误,并不能打开lightbox或移动滑块。和往常一样,他在所有其他浏览器上都运行良好。

The site is in http://themes.thefirm.gambit.ph

网址是http://themes.thefirm.gambit.ph。

You can see the error when in IE8, and when you click on the left or right arrows of the header area.

您可以在IE8中看到错误,以及单击标题区域的左箭头或右箭头。

Object doesn't support this property or method

对象不支持此属性或方法

Can someone please help? Has anyone else encounter this? I'm quite stumped at this and I can't find anything from Google.

有人能帮忙吗?有人遇到过这个吗?我被难住了,我从谷歌上找不到任何东西。

Update: I've uploaded the site and updated this question

更新:我已经上传了网站并更新了这个问题。

2 个解决方案

#1


2  

The line in jQuery (minified version) that's causing the error is:

导致错误的jQuery(缩小版)行是:

somehwere in line 140: var C=Bb.exec(u)

第140行:var C=Bb.exec(u)

The solution is to change this line to:

解决办法是把这条线改为:

var C=Bb.exec(u.toString())

var C = Bb.exec(u.toString())

@kirilloid is correct in that Regexp is throwing the error especially when the value being matched is numeric. e.g. animating css properties such as opacity, top, left, etc. Converting it to string fixes the problem. Now IE is not getting any more errors.

@kirilloid是正确的,因为Regexp会抛出错误,尤其是当被匹配的值是数值时。例如,对css属性进行动画处理,比如不透明度、顶部、左边等等。现在IE没有任何错误。

I don't like this fix very much since I edited the jQuery library file, but I guess I'll have to make do with it. The change doesn't have to have any bad side effects to normal functionality.

我不太喜欢这个修复,因为我编辑了jQuery库文件,但我想我得将就一下了。这种改变不必对正常功能产生任何负面影响。

#2


2  

I just came upon the same problem. Instead of altering jQuery (yes, I realize it's a decent patch in the short term), contact the author of the Wordpress plugin/theme or Wordpress themselves if necessary. They can fix the problem by using string values instead of numeric values when they call .animate() or other effects. For example:

我遇到了同样的问题。与其改变jQuery(是的,我知道它在短期内是一个不错的补丁),不如联系Wordpress插件/主题的作者或者Wordpress本身。它们可以在调用.animate()或其他效果时使用字符串值而不是数值来解决问题。例如:

$(this).animate({opacity:0.5},500);

Should be:

应该是:

$(this).animate({opacity:"0.5"},"500");

In reality, jQuery should address the problem to remain cross-browser, but in the meantime it's a solution.

实际上,jQuery应该解决这个问题,以保持跨浏览器,但同时它是一个解决方案。

#1


2  

The line in jQuery (minified version) that's causing the error is:

导致错误的jQuery(缩小版)行是:

somehwere in line 140: var C=Bb.exec(u)

第140行:var C=Bb.exec(u)

The solution is to change this line to:

解决办法是把这条线改为:

var C=Bb.exec(u.toString())

var C = Bb.exec(u.toString())

@kirilloid is correct in that Regexp is throwing the error especially when the value being matched is numeric. e.g. animating css properties such as opacity, top, left, etc. Converting it to string fixes the problem. Now IE is not getting any more errors.

@kirilloid是正确的,因为Regexp会抛出错误,尤其是当被匹配的值是数值时。例如,对css属性进行动画处理,比如不透明度、顶部、左边等等。现在IE没有任何错误。

I don't like this fix very much since I edited the jQuery library file, but I guess I'll have to make do with it. The change doesn't have to have any bad side effects to normal functionality.

我不太喜欢这个修复,因为我编辑了jQuery库文件,但我想我得将就一下了。这种改变不必对正常功能产生任何负面影响。

#2


2  

I just came upon the same problem. Instead of altering jQuery (yes, I realize it's a decent patch in the short term), contact the author of the Wordpress plugin/theme or Wordpress themselves if necessary. They can fix the problem by using string values instead of numeric values when they call .animate() or other effects. For example:

我遇到了同样的问题。与其改变jQuery(是的,我知道它在短期内是一个不错的补丁),不如联系Wordpress插件/主题的作者或者Wordpress本身。它们可以在调用.animate()或其他效果时使用字符串值而不是数值来解决问题。例如:

$(this).animate({opacity:0.5},500);

Should be:

应该是:

$(this).animate({opacity:"0.5"},"500");

In reality, jQuery should address the problem to remain cross-browser, but in the meantime it's a solution.

实际上,jQuery应该解决这个问题,以保持跨浏览器,但同时它是一个解决方案。