|
|||||||
|
|
|
![]() |
|
|
Strumenti |
|
|
#1 |
|
Member
Iscritto dal: Sep 2005
Messaggi: 125
|
Javascript e XML Problema
Ciao!
Ho realizzatto un javascript che mi legge un file xml ma ora nn mi funziona più in internet explorer! Con mozzilla invece funziona tutto perfettamente! Prima funzionava in entrambe i browser ma il codice è lo stesso! Vi lascio il codice javascript! function importXML() { if (document.implementation && document.implementation.createDocument) { xmlDoc = document.implementation.createDocument("", "", null); xmlDoc.onload = createTable; } else if (window.ActiveXObject) { xmlDoc = new ActiveXObject("Microsoft.XMLDOM"); xmlDoc.onreadystatechange = function () { if (xmlDoc.readyState == 4) createTable() }; } else { alert('Your browser can\'t handle this script'); return; } xmlDoc.load("articolo.xml"); } function createTable() { var x = xmlDoc.getElementsByTagName('articolo'); var newEl = document.createElement('TABLE'); newEl.setAttribute('id','art'); var tmp = document.createElement('TBODY'); newEl.appendChild(tmp); for (i=0;i<x.length;i++) { var row = document.createElement('TR'); for (j=0;j<(x[i].childNodes.length)-2;j++) { if (x[i].childNodes[j].nodeType != 1) continue; var container = document.createElement('TD'); if( x[0].childNodes[j].nodeName == 'indice') container.setAttribute('id','ind'); else container.setAttribute('id','test'); var theData = document.createTextNode(x[i].childNodes[j].firstChild.nodeValue); container.appendChild(theData); row.appendChild(container); } tmp.appendChild(row); } document.getElementById('writeroot2').appendChild(newEl); } Eccolo! Ho provato a mettere un alert prima di " for (i=0;i<x.length;i++) " e appare! l'ho messo appena dentro il for e non appare più in internet explorer! Aiutatemi!
__________________
Non è forte colui che non cade, ma colui che cadendo trova la forza di rialzarsi Bello il mondo dei programmatori!!!
|
|
|
|
|
| Strumenti | |
|
|
Tutti gli orari sono GMT +1. Ora sono le: 18:34.










Non è forte colui che non cade, ma colui che cadendo trova la forza di rialzarsi 








