set checkbox

Giganews Newsgroups
Subject: set checkbox
Posted by:  Ben Dover - Mental Patient 0057 (Ben_Dov…@psychiatric-center.Bellevue-Hospital.com)
Date: Tue, 02 Sep 2003

i'm having trouble setting a checkbox to checked and unchecked

I want to have a form where you click a button. onclick would call a
function that
checks a checkbox on the form.

in the head:
function clearItem(thisOne){
  var fset = document.getElementById(thisOne);
  var inputs = fset.getElementsByTagName("input");
  for (var i = 0; i<inputs.length; i++)
  inputs.item(i).value="checked";
  document.up_data.att3.checked()=(true);
}

in the body:
  <form action="maint.pl" method="POST" name="up_data">

<input type="button" name="xxclrField_fnct1" value="clear"
onclick='clearItem("clrField_fnct1")'>
<input type="checkbox" name="att3">

<fieldset id="clrField_fnct1">
    <input type="text" size=30 name="stu1" value="">
    <input type="text" size=30 name="frm1" value="">

</fieldset>
</form>

Replies