最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - jQuery on IE8, error: Object doesn't support this property or method - Stack Overflow

programmeradmin0浏览0评论

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.

The site is in

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

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

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.

The site is in 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.

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

Share Improve this question edited Feb 15, 2011 at 5:43 Benjamin Intal asked Feb 14, 2011 at 0:16 Benjamin IntalBenjamin Intal 2,8151 gold badge26 silver badges26 bronze badges 7
  • Which value is contained in rfxnum? – kirilloid Commented Feb 14, 2011 at 2:20
  • Is the images you are using PNG images? And if they are, do they have an alpha channel and some transparent parts in them to begin with? IE8 supports PNG transparency but NOT together with opacity and that might be the problem. – David Mårtensson Commented Feb 14, 2011 at 2:42
  • @David IE8 works ok with opacity and even IE6 never get JS errors, just because of opacity. – kirilloid Commented Feb 14, 2011 at 3:26
  • @kirilloid according to IE's dev tools, rfxnum is an Object with a value of /^([+\-]=)?([\d+.\-]+)(.*)$/ with methods apply() and call() – Benjamin Intal Commented Feb 14, 2011 at 7:48
  • @David Yes I have 24bit PNG images in the page, but not on or inside the prettyPhoto link, that's why it's so weird! It's just a standard <a href="jpg" rel="prettyPhoto"><img src="jpg"/></a>. – Benjamin Intal Commented Feb 14, 2011 at 7:50
 |  Show 2 more ments

2 Answers 2

Reset to default 2

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

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

The solution is to change this line to:

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.

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.

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:

$(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.

发布评论

评论列表(0)

  1. 暂无评论