Questa funzione viene eseguita durante i moduli onSubmit e funziona perfettamente in Firefox e Chrome, ma non in IE. Sospetto che sia indexOf, ma non riesco a trovare un modo per farlo funzionare.Perché indexOf non funziona in Internet Explorer?
function checkSuburbMatch(e) {
var theSuburb = document.getElementById('suburb').value;
var thePostcode = document.getElementById('postcode').value;
var arrayNeedle = theSuburb + " (" + thePostcode + ")";
if(suburbs.indexOf(arrayNeedle) != -1) {
alert("Suburb and Postcode match!");
return false;
} else {
alert("Suburb and Postcode do not match!");
return false;
}
}
Che cosa contengono le "periferie" variabili? – Tim
È una serie di stringhe che vanno sulla falsariga di "suburbName (postCode)" – David
possibile duplicato di [Perché indexOf non funziona su un array IE8?] (Http://stackoverflow.com/questions/3629183/why-doesnt -indexof-lavoro-in-un-array-IE8). Vedi anche: [Come risolvere Array indexOf() in JavaScript per i browser IE] (http://stackoverflow.com/questions/1744310/), [Implementazione di indexOf per Internet Explorer] (http://stackoverflow.com/questions/2868696) – CMS