[Javascript] IE/FF, getElementById and checkboxes

Rees, Mark Mark.Rees at astrazeneca.com
Thu May 1 03:54:48 CDT 2008


 
This has always confused me, but in using getElementById, how do you write out the for loop instance differently: for(i = 0; i < actform.deluser.length; i++) 
 

Hassan Schroeder already provided one way to do this - put the following code before the loop, then the above syntax will work (if you change 'deluser' to 'delusers'), as it makes sure delusers is an array
 

var inputs = document.getElementsByTagName("input");

var delusers = Array();

for ( var j = 0; j < inputs.length; j++ )

{

if ( inputs[j].name == "delusers" )

{

delusers.push(inputs[j]);

}

}


 




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.evolt.org/pipermail/javascript/attachments/20080501/47cadfa9/attachment.htm>


More information about the Javascript mailing list