Si alguien encontro alguna solucion viable me lo hace saber.
Gracias
![Afirmando](http://static.forosdelweb.com/fdwtheme/images/smilies/afirmar.gif)
| |||
![]() Hola a todos, no se si a alguien del foro le ha pasado que al realizar una rutina javascript funcione perfectamente en Iexplorer, sin embargo en Firefox no funciona o cuelga el navegador. Revise la web para ver si existe alguna solucion pero no la he encontrado aun. El codigo abre un xml y escribe los registros en una pagina mediante document.write, adjuntando los campos. Si alguien encontro alguna solucion viable me lo hace saber. Gracias ![]() |
| |||
![]() Este es el codigo que uso, solamente al cargar este codigo en firefox me muestra como toda la pagina el resultado de la funcion pero no me coloca el resto de la pagina (no lo muestra). La funcion discrimina el tipo de navegador que se esta usando.
Código:
function loadDataXML() { if (navigator.appName == 'Microsoft Internet Explorer' ) { xmlDoc = new ActiveXObject("Microsoft.XMLDOM"); xmlDoc.onreadystatechange = function () { if (xmlDoc.readyState == 4) creaTabla() }; xmlDoc.load("testenglish.xml"); return true; } else { xmlDoc = document.implementation.createDocument("", "doc", null); xmlDoc.onload = creaTabla; xmlDoc.load("testenglish.xml"); return true; } } function creaTabla() { document.write('<table width="549px" border="0" cellspacing="2" cellpadding="0">'); if (navigator.appName == 'Microsoft Internet Explorer' ) { var x = xmlDoc.getElementsByTagName('company'); var i = 0; while (i<x.length) { document.write('<tr height="120px">'); for (j=0;j<3;j++) { document.write('<td class="style6" align="bottom">'); document.write('<div align="center"><a href="'+x[i].childNodes[1].firstChild.nodeValue+'"><img src="'+x[i].childNodes[2].firstChild.nodeValue+'" alt="'+x[i].childNodes[3].firstChild.nodeValue+'" border="0"></img></a>'); document.write('<br><br><a class="style6" href="'+x[i].childNodes[1].firstChild.nodeValue+'" alt="'+x[i].childNodes[1].firstChild.nodeValue+'">'+x[i].childNodes[0].firstChild.nodeValue+'</a></div></td>'); i++; } document.write('</tr>'); } } else //* Mozilla Firefox u otros *// { var fx = xmlDoc.getElementsByTagName('company'); var i = 0; var m = 0; var z = fx.length; var irs = z % 3; var iac = z / 3; /* alert("Registros: "+fx.length); */ while (i<fx.length) { document.write('<tr height="120px">'); for (j=0;j<fx[i].childNodes.length;j++) { if (fx[i].childNodes[j].nodeType!=3) { document.write('<td class="style6" align="bottom">'); document.write('<div align="center"><a href="'+fx[i].childNodes[3].childNodes[0].nodeValue+'"><img src="'+fx[i].childNodes[5].childNodes[0].nodeValue+'" alt="'+fx[i].childNodes[7].childNodes[0].nodeValue+'" border="0"></img></a>'); document.write('<br><br><a class="style6" href="'+fx[i].childNodes[3].childNodes[0].nodeValue+'" alt="'+fx[i].childNodes[7].childNodes[0].nodeValue+'">'+fx[i].childNodes[1].childNodes[0].nodeValue+'</a></div></td>'); i++; m = i % 3; if (m == 0) { break; } } } document.write('</tr>'); } } document.write('</table>'); } |