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 Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

disabled checkbox

Status
Not open for further replies.

wazilian1

Programmer
Nov 8, 2002
38
US
how would i gray out(or read-only) a checkbox on page load and only allow the user to select the read-only checkbox if the user selected another checkbox first.

it could be used for something like this....

are you 18?
if so, do you have a license?

if you understand that. thanks in advance. wazilian
King of Wazil
 
<script>
function checkThis(){
if (document.myForm.box1.checked == true){
document.myForm.box2.enabled = true
}
else{
document.myForm.box2.checked = false
document.myForm.box2.enabled = false
}
}
</script>

<form name=myForm>
<input type=checkbox name=box1 onClick=&quot;checkThis()&quot;>
<input type=checkbox name=box2 DISABLED>
</form> -----------------------------------------------------------------
[pc] Be nice. It's only doing what you tell it to do.
mikewolf@tst-us.com
 
will this work if the checkboxes are in a table? wazilian
King of Wazil
 
Yes. It doesn't matter where the checkboxes are. This code depends on what you name your checkboxes. What I was trying to show you is the theory that you can use. How you execute it is up to you. It the question only should allow one box to be checked then make sure that all of the boxes are unchecked when one is checked using code similar to mine. -----------------------------------------------------------------
[pc] Be nice. It's only doing what you tell it to do.
mikewolf@tst-us.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top