I'm relatively new to Javascript, I've worked in Actionscript 3.0 so I kinda have the hang of syntax, but I'm having an issue with my code working in firefox.
So I have an XML file with information that I want displaying in specific DIVs but when I run it in Firefox The Alert isn't even appearing at one point I had another else alerting if the page couldn't support the script but it wasn't appearing in firefox either.Code:function loadXML() { var article = "clientInformation.xml" // Load XML from a file on the web server if (window.ActiveXObject) { xmlDoc = new ActiveXObject('Microsoft.XMLDOM'); xmlDoc.async="false"; while (xmlDoc.readyState != 4) {} // readyState will be set to 4 when the document is loaded xmlDoc.load(article); displayXML(); } else if (document.implementation && document.implementation.createDocument) // Broken { xmlDoc = document.implementation.createDocument("","",null); xmlDoc.async="false"; xmlDoc.onload = displayXML(); xmlDoc.load(article); alert("Is this happening?"); } } //on first load function displayXML() { document.getElementById("writeup_container").innerHTML = xmlDoc.getElementsByTagName("company").item(0).text; imageURL = xmlDoc.getElementsByTagName("company")[0].attributes.getNamedItem("image").text; document.getElementById("image_container").innerHTML = "<img src=\"images/ClientSites/" + imageURL + "\"/>" }
The Error I'm getting was:
Error: xmlDoc.getElementsByTagName("company").item(0) is null
Line: 34
So there's my problem, any help would be apprecieated, I'm not a hardcore coder so any code please explain what it does <3Code:document.getElementById("writeup_container").innerHTML = xmlDoc.getElementsByTagName("company").item(0).text;


Reply With Quote

Bookmarks