我尝试创建一个关系/连接 beetwen 2 选择框
<form id="creation" name="creation">
<select name="select01" id="select01">
<option value="01">01</option>
<option value="02">02</option>
<option value="03">03</option>
</select>
<select name="select02" id="select02">
<option value="aa">aa</option>
<option value="bb">bb</option>
<option value="cc">cc</option>
</select>
</form>
我希望我的选择框select02在开始时被禁用,当我点击 value02或value03时,我们启用它,当我们点击value01时,禁用它。
目前有我的代码js。我尝试从其他功能(启用选择框的单选按钮)调整它,但它似乎不起作用。我的列表在开始时被禁用,但 onclick 不起作用......
一些身体可以帮助我吗?
var oui = document.creation.select01[0];
document.getElementById("select02").disabled=true;
oui.onclick = function() {
document.getElementById("select02").disabled=false;
}
好的,现在,我使用以下代码:
<script>
var oui = document.select01;
document.getElementById("select02" ).disabled=true;
oui.onchange = function(){
document.getElementById("select02" ).disabled=false;
}
</script>
我更改了我的 select01 的值,然后我的 select02 现在启用了 .. 但是我怎样才能只针对我的 select01 的 2 个选项?