PDA

View Full Version : IE's indexOf problems.



jlizarraga
08-30-2008, 09:40 AM
I was having trouble with indexOf() and IE6 (worked fine in FF and Safari), and Google led me to this:

http://developer.mozilla.org/En/Core_JavaScript_1.5_Reference:Objects:Array:indexOf#Compatibility

That snippet fixed the problem in IE. Is this always necessary when using indexOf? Is it because of the array? Here is the code:

oIndex = compareVINs.indexOf(oQuery);

Where compareVINs is an array, and oQuery is a string.

Twey
08-30-2008, 09:54 AM
Yes. JScript does not implement Array.prototype.indexOf, which is a non-standard Mozilla extension. String.prototype.indexOf still exists.

jlizarraga
08-30-2008, 07:06 PM
Ah. Thanks!