Image

Imagethepurplestore wrote in Imagejavascript baffled

Select All checkbox

Hello! I'm missing something obvious in the following bit of code...

Expected Result: Clicking Select All selects all checkboxes on the page
Actual Result: Clicking Select All only puts a checkbox in the box I checked

In the header:
function select_all() {
for (var i = 0; i < document.formname.elements.length; i++) {
var elem = document.formname.elements[i];
if ((elem.name != 'allbox1') && (elem.name != 'allbox2') && (elem.type == 'checkbox')) {
  if (document.formname.allbox1.checked == 'true'
  || document.formname.allbox2.checked == 'true') {
   elem.checked = 'true';
   document.formname.allbox1.checked = 'true';
   document.formname.allbox2.checked = 'true';
} } }}

The actual form element:
<input type=checkbox name="allbox1" onCheck="javascript:select_all()" onClick="javascript:select_all()"> Select All
<input type=checkbox name="allbox2" onCheck="javascript:select_all()" onClick="javascript:select_all()"> Select All

See anything obvious?

Thanks much!
-kim.