set checkbox

  • Thread starter Ben Dover - Mental Patient 0057
  • Start date
B

Ben Dover - Mental Patient 0057

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>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,083
Messages
2,570,591
Members
47,212
Latest member
RobynWiley

Latest Threads

Top