TWiki> Main Web>WebProgrammingStuff? >BrowserBugs (16 May 2007, MattWalsh)EditAttach
Browsershots.org will render your page for you in many different browsers and show you if it looks ok

IE chokes on variables assigned to array elements of lists of XML nodes

This code works with Firefox, but with IE you get a complaint about Object doesn't support this action
      for (var i = 0; i < items.length; i++)
      {  x = items[i];  // << ----------- !!!
         title = x.getElementsByTagName('Title')[0].childNodes[0].nodeValue;
      }

Instead simply do this:

      for (var i = 0; i < items.length; i++)
      {  title = items[0].getElementsByTagName('Title')[0].childNodes[0].nodeValue;
      }

FF doesn't give you the XMLHttpRequest.responseXML.xml property

...but IE does. Sometimes you may want the response to Javascript pre-parsed into the XML tree (because it seems to be a pain to have IE do it any other way) but also want the raw XML (say for passing to the next page). XMLHttpRequest.responseXML.xml works for IE, but is undefined in FF. However, XMLHttpRequest.responseText works for both. Duh. I wasted time because I assumed that one or the other would be set.

IE won't let you set innerHTML on a <tr>

confirmed on the web at places like this

<TABLE id="test_table">
<TR id="test_row">
<TD id="test_data">
</TR>
</TABLE>

<SCRIPT language="JavaScript">
// fails with a crummy, vague 'runtime error'
// the_table = document.getElementById("test_table");
// the_table.innerHTML = "<TR><TD>some stuff</TD></TR>";

// also fails with a crummy, vague 'runtime error'
// the_row = document.getElementById("test_row");
// the_row.innerHTML = "<TD>some stuff</TD>";

// works
   the_data = document.getElementById("test_data");
   the_data.innerHTML = "<TD>some stuff</TD>";
</SCRIPT>

-- MattWalsh - 17 Mar 2007

Topic revision: r4 - 16 May 2007 - 17:40:40 - MattWalsh
 
This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback