title: How to get child element by class name?
body: <p>I'm trying to get the child span that has a class = 4. Here is an example element:</p>
  
  <pre><code>&lt;div id="test"&gt;
   &lt;span class="one"&gt;&lt;/span&gt;
   &lt;span class="two"&gt;&lt;/span&gt;
   &lt;span class="three"&gt;&lt;/span&gt;
   &lt;span class="four"&gt;&lt;/span&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>The tools I have available are JS and YUI2. I can do something like this:</p>
  
  <pre><code>doc = document.getElementById('test');
  notes = doc.getElementsByClassName('four');
  
  //or
  
  doc = YAHOO.util.Dom.get('#test');
  notes = doc.getElementsByClassName('four');
  </code></pre>
  
  <p>These do not work in IE. I get an error that the object (doc) doesn't support this method or property (getElementsByClassName). I've tried a few examples of cross browser implementations of getElementsByClassName but I could not get them to work and still got that error.</p>
  
  <p>I think what I need is a cross browser getElementsByClassName or I need to use doc.getElementsByTagName('span') and loop through until I find class 4. I'm not sure how to do that though. </p>