我在网页中有两个选择框(一个用于汽车类型,另一个用于汽车模型),我想根据另一个使用JavaScript更改其中的一个。根据另一个选择列表值选择选择列表值
的代码示例是,如下:
<html>
<head>
<script type="text/javascript">
function showCarModels(CarTypeVaraiable)
{
//I want to hide all the options in the CarModelsList and select the options with name property value equals to CarTypeVaraiable Value .. How I can write this in JavaScript ?????
}
</script>
</head>
</script>
<body>
<p>Selecting Car Models depending on the Car Type Value ..... </p>
Car Type<select id="selCarType" name="selCarType" class="selCarType" size="1" onchange="showCarModels('selCarType');">
<option class="City" value="0" selected="selected">choose Car Type</option>
<option class="CarType" value="100" >Toyota</option>
<option class="CarType" value="200" >Chevrlolet</option>
<option class="CarType" value="300" >Kia</option>
</select>
Car Model
<select id="selCarModel" name="selCarModel" class="selCarModel" size="1">
<option class="City" value="0">choose Car Model</option>
<option class="CarType" value="110" name="100" title="13" >Toyota optra</option>
<option class="CarType" value="120" name="100" title="13" >Toyota Aveo</option>
<option class="CarType" value="130" name="100" title="13" >Toyota Corolla</option>
<option class="CarType" value="210" name="200" title="13" >Chevrlolet Optra</option>
<option class="CarType" value="220" name="200" title="13" >Chevrlolet Aveo</option>
<option class="CarType" value="301" name="300" title="13" >Kia Rio</option>
<option class="CarType" value="450" name="300" title="13" >Kia Optima</option>
<option class="CarType" value="600" name="300" title="13" >Kia Serato</option>
</select>
</body>
</html>
我应该在代码中进行两个下拉列表之间的这种依赖性写?
嗯......你不能在'