Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Checkboxes

Status
Not open for further replies.

VisBasDude

Programmer
Nov 10, 2002
19
GB
HI, i have some checkboxes on a form, and i want to be able to set if they are checked or not when the form loads. What is the command to do this?? Thanx James
 
Checked: <input type=&quot;checkbox&quot; name=&quot;check1&quot; checked>
Unchecked: <input type=&quot;checkbox&quot; name=&quot;check2&quot;>

Rick -----------------------------------------------------------
 
This is really a javascript question...

<script>
function checkBoxes(){
for (x=0; x< document.myForm.elements.length; x++){
if (document.myForm.elements[x].type == &quot;checkbox&quot;){
if (document.myForm.elements[x].checked == true){
alert(document.myForm.elements[x].name + &quot; is checked.&quot;)
}
}
}
}
</script>
<body onLoad=&quot;checkBoxes()&quot;>
<form name=&quot;myForm&quot;>

</form> Get the Best Answers! faq333-2924
Is this an asp FAQ? faq333-3048

mikewolf@tst-us.com
 
Oopss!

I thought you wanted to see if they were checked already.

Sorry. [dazed] Get the Best Answers! faq333-2924
Is this an asp FAQ? faq333-3048

mikewolf@tst-us.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top