...

View Full Version : content changing and disabling the drop down menus



telmessos
08-30-2006, 03:19 PM
Hi all,

I have two drop down boxes next to each other with the same options

<select name="view" class="style2">
<option value="no" selected>N/A</option>
<option value="forestview">Forest View</option>
<option value="seaview">Sea View</option>
<option value="lakeview">Lake View</option>
<option value="mountainview">Mountain View</option>
</select>

I want the second one to be disabled when first one is N/A.
If any other options are chosen in the first one I want the second one has all options except the option which is chosen on the first one.

For example:

if option Forest View is chosen in the first drop down menu. I want the second drop down appear like following:

<select name="view2" class="style2">
<option value="no" selected>N/A</option>
<option value="seaview">Sea View</option>
<option value="lakeview">Lake View</option>
<option value="mountainview">Mountain View</option>
</select>

Any idea?

Thanks

Ceyhun

vwphillips
08-30-2006, 04:08 PM
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">


<head>
<title></title>
<script language="JavaScript" type="text/javascript">
<!--
function Cng(obj,nme){
document.getElementsByName(nme)[0].removeAttribute('disabled');
if (obj.value=='no'){
document.getElementsByName(nme)[0].setAttribute('disabled','disabled');
}
}
//-->
</script>
</head>

<body>

<select name="view" class="style2" onchange="Cng(this,'view2');">
<option value="no" selected>N/A</option>
<option value="forestview">Forest View</option>
<option value="seaview">Sea View</option>
<option value="lakeview">Lake View</option>
<option value="mountainview">Mountain View</option>
</select>

<select name="view2" class="style2" disabled="disabled" >
<option value="no" selected>N/A</option>
<option value="forestview">Forest View</option>
<option value="seaview">Sea View</option>
<option value="lakeview">Lake View</option>
<option value="mountainview">Mountain View</option>
</select>
</body>

</html>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum