[Javascript] IE/FF, getElementById and checkboxes
Hassan Schroeder
hassan at webtuitive.com
Wed Apr 30 19:50:45 CDT 2008
Alan Easton wrote:
1. problems in Firefox? install Firebug. now. :-)
2. can't identify a failure? wrap everything in a try/catch
block and alert it -- hard to miss, and it stops a failed
form submission on the spot
> <script language="JavaScript">
Uh, the "language" attribute to the script tag has been deprecated
for, what, about 10 years now? Not the problem here, but...
> for(i = 0; i < actform.delusers.length; i++) <----THIS LINE
yep, you don't have an array there in FF. Something like:
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]);
}
}
:: would do it. Just one approach, TMTOWTDI.
> if(actform.delusers(i).checked) <---THIS LINE
if ( delusers[i].checked )
The error thrown in a try/catch block for your version is
TypeError: delusers is not a function
which is a pretty good clue, even if you're going glazed-eyed
from staring at the same code block too long. :-)
HTH!
--
Hassan Schroeder ----------------------------- hassan at webtuitive.com
Webtuitive Design === (+1) 408-621-3445 === http://webtuitive.com
dream. code.
More information about the Javascript
mailing list