[thelist] opposite of checked="checked"

Jeff Howden jeff at jeffhowden.com
Tue Jun 21 15:04:03 CDT 2005


Brian,

><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
> From: Brian Cummiskey
> 
> > Basically, you're going to need client scripting to\
> > pull this off.
> 
> Yeah, it looks that way :(
><><><><><><><><><><><><><><><><><><><><><><><><><><><><><

At the very basic, the following will reset a radio button.

document.forms[formNameOrIndex].elements[elementNameOrIndex].checked =
false;

For something alittle more generic, here's a function that'll take a form
object and reset all radio buttons it finds within that form:

function resetRadioButtons(oForm)
{
  var returnValue = false;
  if(oForm)
  {
    for(var i = 0; i <= oForm.elements.length; i = i + 1)
    {
      if(oForm.elements[i].type.toLowerCase() == 'radio')
        oForm.elements[i].checked = false;
    }
    returnValue = true;
  }
  return returnValue;
}

Place a call to this function at the bottom of your HTML document passing an
object reference to the associated form and that should take care of it.

 [>] Jeff Howden
     jeff at jeffhowden.com
     http://jeffhowden.com/



More information about the thelist mailing list