Jump to content

Javascript and XML in IE6 and FF3


rhyspaterson

Recommended Posts

Hey lads,

 

We use IE6 as the standard browser in our SOE at work (so i have been developing for it). However i just noticed this the other day:

 

<script type="text/javascript">
function parseXML()
{
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);
    return;
    }
  }
xmlDoc.async=false;
xmlDoc.load("scheduled_files/required_files/printers.xml");
document.getElementById("clear").innerHTML=xmlDoc.getElementsByTagName("clear")[0].childNodes[0].nodeValue;
document.getElementById("attention").innerHTML=xmlDoc.getElementsByTagName("attention")[0].childNodes[0].nodeValue;
document.getElementById("critical").innerHTML=xmlDoc.getElementsByTagName("critical")[0].childNodes[0].nodeValue;
}
</script>

....

<div class="navitem">
  <ul>
    <li class="green"><span id="clear">?</span> are clear</li>
    <li class="yellow"><span id="attention">?</span> require attention</li>
    <li class="red"><span id="critical">?</span> are critical</li>
  </ul>
</div>

 

The '?'s are updated fine in IE6, but not FF3. Obviously it is some quite basic change, but cross browser javascript is all still quite new to me :P

 

The XML file looks as such:

 

<printers>
<clear>48</clear>
<attention>21</attention>
<critical>17</critical>
<total>86</total>
</printers>

 

Suggestions?

 

Cheers :P

Link to comment
https://forums.phpfreaks.com/topic/115784-javascript-and-xml-in-ie6-and-ff3/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.