Esta función se ejecuta durante los formularios en Enviar y funciona bien en Firefox y Chrome, pero no en IE. Sospecho que es indexOf, pero parece que no puedo encontrar la manera de hacerlo funcionar.¿Por qué el índiceOf no funciona en 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;
}
}
¿Qué contiene "suburbios" variables? – Tim
Es un conjunto de cadenas que van en la línea de "suburbName (postCode)" – David
posible duplicado de [¿Por qué no funciona IndexOf en una matriz IE8?] (Http://stackoverflow.com/questions/3629183/why-doesnt -indexof-work-on-an-array-ie8). Ver también: [Cómo arreglar Array indexOf() en JavaScript para navegadores IE] (http://stackoverflow.com/questions/1744310/), [Array indexOf implementation for Internet Explorer] (http://stackoverflow.com/questions/2868696) – CMS