Need help with script to show a hidden text box if a check box is checked 
Author Message
 Need help with script to show a hidden text box if a check box is checked

Hi
I am new to java script and am having major trouble with this.  I am looking
to hide a text box until the viewer places a check in the check box.  Any
help would be greatly appreciated.


Fri, 25 Jul 2003 07:28:51 GMT  
 Need help with script to show a hidden text box if a check box is checked
Here you go:

   <input type="Checkbox" id="chkTest" checked
          onclick="javascript:document.all.edTest.style.display =
          (document.all.chkTest.checked) ? 'inline' : 'none';">
          Toggle
          <input type="Text" id="edTest">

P.S - Sorry about the word-wrap.

Enjoy,
-Jim Rofkar.


| Hi
| I am new to java script and am having major trouble with this.  I am looking
| to hide a text box until the viewer places a check in the check box.  Any
| help would be greatly appreciated.



Fri, 25 Jul 2003 09:00:01 GMT  
 Need help with script to show a hidden text box if a check box is checked
Don't know how "cross browser compatible" this is, but it's at least IE4+...

<form name="myform" ...>
<input type="text" name="mytext" style="display:none">
...
</form>

In code,

document.myform.mytext.style.display = "inline"; // shows
document.myform.mytext.style.display = "none"; // hides

There's also ...style.visiblity property that works a little differently...

style Object
http://msdn.microsoft.com/workshop/author/dhtml/reference/objects/obj...

--
Michael Harris
Microsoft.MVP.Scripting
--

Please do not email questions - post them to the newsgroup instead.
--

Quote:

> Hi
> I am new to java script and am having major trouble with this.  I am looking
> to hide a text box until the viewer places a check in the check box.  Any
> help would be greatly appreciated.



Fri, 25 Jul 2003 09:41:18 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Dependent Text Boxes via Check box

2. Show text boxes on onchange event of dropdown box

3. How to: Loop through all objects and count the checked check boxes

4. Check Box being checked if database value is equal to ON

5. Assigning text value to check box

6. Text box text on new page text box

7. check boxes and ASP/ADO - help please

8. Help...Check Boxes

9. check boxes and ASP/ADO - help please

10. creating a text box errors message for empty text box

11. passing variables from a text box to a document.write text box

12. I need help reading text from a dialog box

 

 
Powered by phpBB® Forum Software