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

vbscript question

Status
Not open for further replies.

Nerus

Technical User
Joined
Aug 24, 2001
Messages
2
Location
US
Hi, I have a pretty simple question but I'm not sure how simple the solution is.

I have a drop down menu that looks like this.
<html>
<head>
<SCRIPT LANGUAGE=&quot;VBScript&quot;>
Function Event
If document.form.ddmenu.SelectedIndex = 2 Then
document.write(&quot;<input type=&quot;&quot;checkbox&quot;&quot; name=&quot;&quot;checkbox&quot;&quot; value=&quot;&quot;ON&quot;&quot; disabled>Check Here&quot;)
End If
End Function
</SCRIPT>
</head>
<body>
<form name=&quot;form&quot;>
<select size=&quot;1&quot; name=&quot;ddmenu&quot; OnChange=&quot;Event&quot;>
<option>Option 0</option>
<option>Option 1</option>
<option>Option 2</option>
</select>
<input type=&quot;checkbox&quot; name=&quot;checkbox&quot;>Check Here
</body>
</html>

Basically, when a user opens this page there will be a drop down menu with three options and a checkbox next to it. My goal is to simply grey the checkbox out(disable) when option 2 is selected. And then when any other option is chosen it becomes ungreyed. However, with my limited vbscript knowledge I can only accomplish this by reloading the page or by using frames. Neither of those options is really desirable. Please help if you can! Thanks!

-Nerus
 
Here is an example, hope it helps :)
<html>
<head>
<SCRIPT LANGUAGE=&quot;VBScript&quot;>
Sub ddmenu_changed()
Dim selitem
selitem = document.form1.ddmenu.Value
if selitem=2 then
document.form1.check1.disabled = True
else
document.form1.check1.disabled = False
end if
End Sub
</SCRIPT>
</head>
<body>
<form name=&quot;form1&quot;>
<input type=text name=&quot;result&quot;>
<select name=&quot;ddmenu&quot; onChange=&quot;ddmenu_changed()&quot;>
<option value=&quot;0&quot;>Option 0</option>
<option value=&quot;1&quot;>Option 1</option>
<option value=&quot;2&quot;>Option 2</option>
</select>
<input type=&quot;checkbox&quot; name=&quot;check1&quot;>Check Here
</form>
</body>
</html>
 
Thankyou sooooooooooooooooooooooooooooooooooooo much!!!! =)
Yes, that worked!!!!!!!!!!!!
thanks again cpope!

-Nerus
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top