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!

Help With Hiding/Showing Inpu Box with checkbox

Status
Not open for further replies.

smurfer

Programmer
Jun 8, 2001
57
US
I have a form that contains a checkbox, and also have a textarea that corresponds to this check box. I want to hide the textarea by default, but if the user checks the checkbox, I want the textarea to become visible for input. So if the user selcts the checkbox, the textarea appears? What and how is the easiest way to do this?
Thanks,
SM
 
You have to use VbScript/JavaScript

here's the code with vbscript
<Script>

sub Boxstatus()
document.all.t1.style.display = &quot;none&quot;
document.all.c1.checked= &quot;false&quot;
If (document.all.c1.checked= true) then
document.all.t1.style.display = &quot;inline&quot;
end if

end sub

<body onload=&quot;BoxStatus()&quot;>


<input type=&quot;checkbox&quot; name=&quot;c1&quot; id = &quot;c1&quot; value =1 onchange=&quot;BoxStatus()&quot;>
<input type=text name=&quot;t1&quot; >

</Body>

Hope this helps
Pls check the syntax
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top