Iterate through spans using javascript
<p>Using only Javascript, how can I iterate through every span id = "expiredDate"? I would think that this would be quite easy with a for each loop, but it doesn't appear to exist in javascript. My below code only works for the first element.</p>

<pre><code>&lt;script type="text/javascript"&gt;
window.onload = function() {
    var definedDate = window.document.getElementById('expiredDate').innerHTML.split("-");
    var expiredDate = new Date(definedDate[0], definedDate[1] - 1, definedDate[2]);
    var graceDate = new Date(definedDate[0], definedDate[1] - 1, definedDate[2] - 30);
    var currentDate = new Date();

    if(currentDate &gt; expiredDate) {document.getElementById('expiredDate').style.color = '#cc6666';}
    else if(currentDate &lt; expiredDate &amp;&amp; currentDate &gt; graceDate) {document.getElementById('expiredDate').style.color = '#f0c674';}
    else {document.getElementById('expiredDate').style.color = '#b5bd68';}
}
&lt;/script&gt;
&lt;span id="expiredDate"&gt;2013-01-01&lt;/span&gt;
&lt;span id="expiredDate"&gt;2014-01-01&lt;/span&gt;
&lt;span id="expiredDate"&gt;2015-01-01&lt;/span&gt;
</code></pre>
