salve a tutti.. ho il seguente script che carica dei dati da un file xml
codice:
var XMLFile="ticker.xml"
var xml = null;
var pausecontent = new Array();
if (document.implementation && document.implementation.createDocument) {
xml = document.implementation.createDocument("","",null)
xml.onload=init_data;
xml.load(XMLFile);
} else if (window.ActiveXObject) {
xml = new ActiveXObject("Microsoft.XMLDOM")
xml.onreadystatechange = IEGo;
xml.load(XMLFile);
}
function IEGo() {
if (xml.readyState == 4)
init_data();
}
function init_data() {
var root = xml.getElementsByTagName("xmlticker")[0];
for(i=0;i < root.childNodes.length;i++) {
items = root.childNodes[i]
current_msg = "";
current_msg += "" + items.getAttribute("materia") + "
";
if (items.getAttribute("url")!=null) {
current_msg += '<a href="' + items.getAttribute("url") + '"';
if (items.getAttribute("target")!=null)
current_msg += ' target="' + items.getAttribute("target")+'"';
current_msg += '>';
}
current_msg += items.firstChild.nodeValue;
if (items.getAttribute("url")!=null)
current_msg += '</a>';
pausecontent[i] = current_msg;
}
}
il file xml è il seguente..
codice:
<?xml version="1.0"?>
<xmlticker>
<message materia="materia1">descrizione1</message>
<message materia="materia1" url="http://www.miosito.com">descrizione2</message>
<message materia="materia2" url="http://www.miosito.com" target="_blank">messaggio2</message>
......
........
</xmlticker>
con internet explorer 7 funziona perfettamente invece con fire fox mi da il seguente errore "items.getAttribute is not a function"
------------------------------
x br1: scusami per il titolo dell'altro thread, sarà il sonno ma come titolo avevo pensato "problema con xml" non era mia intenzione ingannare gli utenti.. ho stentato anche io a riconoscere il mio post dal titolo visto che mi ricordavo di aver messo "problema con xml"
p.s: ho provato a scriverti in pvt ma hai la casella piena.. se puoi cancella l'altro post e poi modifico l'ultimo pezzo di questo..
scusami ancora, grazie