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

Using Check boxes

Status
Not open for further replies.

AgentM

MIS
Jun 6, 2001
387
US
Hi
I am trying to diplay a hidden List box when a check box is clicked and at the same time hide another text box.

Here's the code so far:
<SCRIPT language=&quot;VBScript&quot;>
Sub ChgDept()
If document.chkDept.value = 1 then
document.txtbox1.style.visibility = hidden
document.listbox1.style.visibility= visible
end if
end sub
</SCRIPT>
<FORM>
<INPUT size=&quot;20&quot; type=&quot;text&quot; name=&quot;txtbox1&quot; value=&quot;<%= fieldname1%>&quot; style=&quot;visibility:visible&quot;>
<SELECT size=&quot;1&quot; name=&quot;lDept&quot; style=&quot;visibility:hidden&quot;>
<OPTION>Select Department from the menu</OPTION>
<% While Not objrec2.EOF %>
<OPTION> <%= rs(&quot;fieldname2&quot;)%></OPTION>
<%objrec2.movenext
Wend %></SELECT>
<BR>

<INPUT type=&quot;checkbox&quot; name=&quot;chkDept&quot; value=&quot;1&quot; onselect=&quot;ChgDept()&quot;><BR>
</FORM>

It's not working any ideas Why????
 
I assume the script block defaults to run on the client.
I also ssume that hidden and visible are not variables although they appear in the script as variables. Will this do it?
Code:
SCRIPT language=&quot;VBScript&quot;>
Sub ChgDept()
    If document.chkDept.value = 1 then 
       document.txtbox1.style.visibility = &quot;hidden&quot; 
       document.listbox1.style.visibility= &quot;visible&quot;
   end if
end sub
</SCRIPT>
 
No that didn't work...
Scripting is client-side.
Thank you for the response..
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top