[Javascript] IE/FF, getElementById and checkboxes
Peter Brunone
peter at brunone.com
Thu May 1 07:23:39 CDT 2008
I'm pretty sure* that if you refer to a form element by name *within the form structure* with a fully qualified name, you should be fine. It would be an unfortunate loss if we no longer had the ability to work with form elements in that way.
* (I'm not a standards expert so feel free to DOM-slap me if I'm wrong)
----------------------------------------
From: "Rees, Mark" <Mark.Rees at astrazeneca.com>
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/3995acd4/attachment.htm>
More information about the Javascript
mailing list