Jump to content
Sign in to follow this  

XML issue with Firefox

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>

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Create New...