Click to See Complete Forum and Search --> : disabling with conditions


aspro
01-15-2003, 05:45 PM
I would like to know how to disable a textarea on the condition that an certain option in a drop down menu is selected. Can this be done? and if so how?
Thanks,
aspro:)

AdamBrill
01-15-2003, 05:58 PM
Check this out:

<html>
<head>
<title>New Page 1</title>
<script language=javascript>
function run()
{
if(document.form1.selectbox.value=="TRUE")
{
document.form1.text.disabled=false;
}
else if(document.form1.selectbox.value=="FALSE")
{
document.form1.text.disabled=true;
}
}
</script>
</head>
<body>
<form method="POST" name=form1>
<textarea rows="2" name="text" cols="20"></textarea>
<select size="1" onchange="run()" name="selectbox">
<option value=TRUE>Enable</option>
<option value=FALSE>Disable</option>
</select>
</form>
</body>
</html>