title: Select and add class in javascript
body: <p>Cross Platform if possible, how can I select classes in Javascript (but not Jquery please -MooTools is fine though-) on code that I can't add an ID?
  Specifically, I want to add the class "cf" on any li below:</p>
  
  <p>HTML</p>
  
  <pre><code>&lt;div class="itemRelated"&gt;
    &lt;ul&gt;
  &lt;li class="even"&gt;
  &lt;li class="odd"&gt;
  &lt;li class="even"&gt;
  </code></pre>
  
  <p>I tried to fiddle it but something is missing:</p>
  
  <p>Javascript</p>
  
  <pre><code> var list, i;
  list = document.getElementsByClassName("even, odd");
  for (i = 0; i &lt; list.length; ++i) {
      list[index].setAttribute('class', 'cf');
  }
  </code></pre>
  
  <p><a href="http://jsfiddle.net/r7BY8/1/" rel="noreferrer">JSFiddle</a></p>
  
  <p>ps. This question phenomenally has possible <a href="https://stackoverflow.com/questions/17944843/add-class-with-javascript">duplicates</a>, (another <a href="https://stackoverflow.com/questions/17944843/add-class-with-javascript">one</a>) but none of the answers makes it clear.</p>