
26/09/2011, 06:24
|
 | Colaborador | | Fecha de Ingreso: junio-2008
Mensajes: 5.032
Antigüedad: 16 años, 8 meses Puntos: 1012 | |
Respuesta: porque no me funciona bien esta funcion js prueba a cambiar estas cosas Cita: function MostrarNombres(){
* * * * var nombres= xml.getElementsByTagName('nombre')[i].firstChild.nodeValue; // no asignes el mismo nombre a una variable y a un objeto, tendrás problemas en algunos navegadores
* * *
document.getElementById("nombres").innerHTML ='<p>'+nombres+'</p>'; // la id del campo no sería, registro??
* * * * * * * * *
* * * * * * * * * if(i>=(nombres_img.length)){i = 0} // nombres_img no está definido
* * * * * * }
* * * * }
* * }
}
*
* * * * window.onload = MostrarRegistos;
* * * * setInterval(MostrarRegistos,4000) // no le encuentro sentido. un ciclo interminable y reutilizas una vez tras otra el objeto
* * * *
var *Ajax = objetoAjax();
Ajax.open('get', 'archivo.xml'); // no usas el 3º parámetro (sincrono o asincrono)
Ajax.onreadystatechange = MostrarNombres;
Ajax.send(''); // envia null
*
function objetoAjax() * {
var ajax = false;
if (window.XMLHttpRequest) {
ajax = new XMLHttpRequest();
if (ajax.overrideMimeType) {
ajax.overrideMimeType('text/xml');
}
} else if (window.ActiveXObject) {
try {
ajax = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
ajax = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e) {}
}
}
return ajax;
} |