Have a Javascript which works in Chrome and Firefox but not IE
<p>I've created a simple javascript to select all check boxes. It works in two browsers but not one. Can anyone help me with this script to make it compatible with IE8 or above.</p>

<pre><code>&lt;script language="JavaScript"&gt;

function toggle(source) {

  checkboxes = document.getElementsByName('marked[]');

  for(var i in checkboxes)

    checkboxes[i].checked = source.checked;

}

&lt;/script&gt;

    &lt;p&gt;

        &lt;input type="checkbox" onClick="toggle(this)" /&gt; Select All

    &lt;/p&gt; 
</code></pre>

<p>Thanks,</p>

<p>Jonah</p>
