下拉列表,如何响应onclick事件
发布网友
发布时间:2022-05-26 07:28
我来回答
共1个回答
热心网友
时间:2023-10-08 17:28
<body>
<script>
function testClk(){
var obj = document.getElementById("slec");
if (obj.value == "是")
{
form1.f1.disabled = false;
form1.f2.disabled = false;
form1.f3.disabled = false;
form1.f4.disabled = false;
}
if (obj.value == "否")
{
form1.f1.disabled = true;
form1.f2.disabled = true;
form1.f3.disabled = true;
form1.f4.disabled = true;
}
}
</script>
<form id="form1" name="form1" method="post" action="1.ASP">
<select name="aaa" id="slec" onchange="testClk()">
<option value="否" >否</option>
<option value="是" >是</option>
</select>
<input type="text" id="f1" name="f1" value="1" disabled >
<input type="text" id="f2" name="f2" value="2" disabled >
<input type="text" id="f3" name="f3" value="3" disabled>
<input type="text" id="f4" name="f4" value="4" disabled >
</form>
</body>