title: SCRIPT5007 IE9 getElementsByTagName
body: <p>Why is this simple thing not working in IE 9? It works just fine i FF and Chrome.</p>
  
  <pre><code>&lt;script language="javascript" type="text/javascript"&gt;
      function displayBusinessCardData() {
          var xmldata = document.getElementById("xmldata1");
          var bizCard = xmldata.getElementsByTagName("BusinessCard")[0];
  
          var name = "Name: " +  bizCard.getElementsByTagName("name")[0].firstChild.data;
          var phone1 = "Phone: " +  bizCard.getElementsByTagName("phone")[0].firstChild.data;
          var phone2 = "Phone: " + bizCard.getElementsByTagName("phone")[1].firstChild.data;
          var phone3 = "Phone: " + bizCard.getElementsByTagName("phone")[2].firstChild.data;
          var email = "Email: " + bizCard.getElementsByTagName("email")[0].firstChild.data;
  
          alert("BusinessCard Data: \n\n" + name + "\n" + phone1 + "\n" + phone2 + "\n" + phone3 + "\n" + email);
      }
  &lt;/script&gt;
  
  &lt;xml id="xmldata1" style="display:none"&gt;
  &lt;BusinessCard&gt;
      &lt;name&gt;Joe Marini&lt;/Name&gt;
      &lt;phone type="mobile"&gt;(415) 555-4567&lt;/phone&gt;
      &lt;phone type="work"&gt;(800) 555-9876&lt;/phone&gt;
      &lt;phone type="fax"&gt;(510) 555-1234&lt;/phone&gt;
      &lt;email&gt;joe@joe.com&lt;/email&gt;
  &lt;/BusinessCard&gt;
  &lt;/xml&gt;
  
  &lt;a href="javascript:displayBusinessCardData()"&gt;Show Business Card Data&lt;/a&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p>It fails with "xmldata.getElementsByTagName("BusinessCard")[0];" with the result being null for bizCard.</p>