Javascript + Click all divs
<p>I trying to have a javascript function to click all divs that has an id of 'divResults' in my form but apparently it doesn't work, no errors but nothing buldges. Please advice. Thanks.</p>

<pre><code> &lt;a href="javascript:clickAllDivs()"&gt;Expand All&lt;/a&gt;  |  &lt;a href="javascript:clickAllDivs()" &gt;Collapse All&lt;/a&gt;
</code></pre>

<p>JavaScript :</p>

<pre><code>     function clickAllDivs() {
                         var els = document.getElementsByTagName('div');
                         var i = els.length; while (i--)
                             if (els[i].id == 'divResults' ) {
                             //alert("I am in"); //Check if div is eating this function
                             els[i].click();
                         }
                     }
</code></pre>
