Jump to content

XML issue with Firefox


PlayerUno

Recommended Posts

Hey guys, I'm pretty rusty on my XML and have worked off some code online to display an XML RSS in Explorer, but it unfortunately isn't working in Firefox. Any one know what I could do to make it work accross all browzers?

function loadXMLDoc(dname){try //Internet Explorer { xmlDoc=new ActiveXObject("Microsoft.XMLDOM"); }catch(e) { try //Firefox, Mozilla, Opera, etc. { xmlDoc=document.implementation.createDocument("","",null); } catch(e) {alert(e.message)} }try { xmlDoc.async=false; xmlDoc.load(dname); return(xmlDoc); }catch(e) {alert(e.message)}return(null);}
[...]
<script type="text/javascript"> //document.write("Test1"); var xmlDoc = loadXMLDoc("rss-manuals-eng.xml"); //document.write("Test2"); var y = xmlDoc.getElementsByTagName("item"); //document.write("Test3"); //document.write(y.length); var z; for (z=0; z<y.length; z++){ //document.write(z); document.write("<h2>"+ y[z].childNodes[0].childNodes[0].nodeValue +"</h2>");// title document.write("<p><strong>"+ y[z].childNodes[3].childNodes[0].nodeValue + "<\/strong>: ");// date document.write(y[z].childNodes[2].childNodes[0].nodeValue+ "<br>"); // description document.write('<a href="' + y[z].childNodes[1].childNodes[0].nodeValue + '">Link here<\/a><\/p>'); // link }</script>
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...