admin管理员组

文章数量:1287631

I only receive this error in Internet Explorer 9. IE7, IE8 and IE10 run the script fine. It is a banner of fading images, one after the other all stacked and fade in to each other.

When you attempt to load the page on IE9, it throws an error. The error occurs within prototype.js and I get this error.

SCRIPT5007: Unable to get property 'replace' of undefined or null reference prototype.js, line 334 character 24

Why would this happen in IE9 but not any earlier version??

I only receive this error in Internet Explorer 9. IE7, IE8 and IE10 run the script fine. It is a banner of fading images, one after the other all stacked and fade in to each other.

When you attempt to load the page on IE9, it throws an error. The error occurs within prototype.js and I get this error.

SCRIPT5007: Unable to get property 'replace' of undefined or null reference prototype.js, line 334 character 24

Why would this happen in IE9 but not any earlier version??

Share Improve this question edited Jul 29, 2013 at 17:15 Naftali 146k41 gold badges247 silver badges304 bronze badges asked Jul 29, 2013 at 17:13 EHermanEHerman 1,9037 gold badges33 silver badges52 bronze badges 5
  • 1 What code are you running to trigger this error? What's the code in prototype.js around line 334? – Alex Wayne Commented Jul 29, 2013 at 17:18
  • The code on line 334 is ` if (e != $break) throw e; ` I'm not exactly sure what is running. Its a div with 4 stacked images, effected by 3 different js libraries to get it fading in and out. Site is www.nobellearning./hla – EHerman Commented Jul 29, 2013 at 17:31
  • I opened your page in IE9 and I see 2 errors. One is $jquery('#wpcontent_slider').coinslider({}). Your object has keys and not values. Your 2nd error is on line 1400 character 13 for me. if(/MSIE/.test(navigator.userAgent) && !window.opera){element.style.filter = element.getStyle('filter').replace(/alpha\([^\)]*\)/gi,'');} This is inside of a setStyle method. Where are you calling setStyle? This seems to be for when an 'opacity' is set. – gen_Eric Commented Jul 29, 2013 at 17:39
  • Also, try upgrading to the latest version of prototype.js – gen_Eric Commented Jul 29, 2013 at 17:41
  • It must be calling setStyle within one of the libraries. I haven't called that my self – EHerman Commented Jul 29, 2013 at 17:49
Add a ment  | 

4 Answers 4

Reset to default 4

I was getting the same error message, because I was using a .html() operation on an XML tag.

var myXML = '<someTag att1=""><cell></cell></someTag>' ;

$(myXML).html(); // which was giving the error msg.

// Instead use the below option 

$(myXML).children() ;// instead this work with IE

Note: Above example is not what I actually tried, it's just to give a representation of the problem.

You should try using the X-UA-Compatible tag. Many libraries do not work well with IE9 and need to be run in IE8 patible mode.

<meta http-equiv="X-UA-Compatible" content="IE=8" />

I've resolved the issue after a few hours of hair pulling and teeth grinding.

I did not realize that scriptaculous was reliant upon prototype.

I was updating prototype while leaving an outdated version of scriptaculous effects linked which was throwing many errors.

After updating to scriptaculous 1.9 and then updating prototype to 1.7, all was well and no errors are thrown.

Thank you all to those who helped, I appreciate all the ments!

Well, most of the time this error occures because of the .html() operation in jquery to parse XML. Remove this and use .text() instead will solve the problem.

本文标签: javascriptUnable to get property 39replace39 of undefinedonly in IE9Stack Overflow