<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<script>
function change(index){
if(index==0){
document.getElementsByName("x2")[0].style.display="";
document.getElementsByName("x3")[0].style.display="none";
}
else if(index==1){
document.getElementsByName("x2")[0].style.display="none";
document.getElementsByName("x3")[0].style.display=""; }else{
document.getElementsByName("x2")[0].style.display="none";
document.getElementsByName("x3")[0].style.display="none";
}
}
</script>
第一个下拉 <select name="x1" onchange='change(this.options[this.selectedIndex].value)'>
<option value="0">0 </option>
<option value="1">1 </option>
<option value="2">2 </option>
</select>
第2个下拉 <select name="x2" >
<option value="0">0 </option>
<option value="2">1 </option>
<option value="3">2 </option>
</select>
第3个下拉 <select name="x3" style='display:none;'>
<option value="0">0 </option>
<option value="1">1 </option>
<option value="2">2 </option>
</select> </body>
</html>
解决方案 »
- 邮箱、论坛之类的富文本编辑框如何实现的?
- Excel向IE导入数据时,提示Automation 不能创建对象
- DOMParser.parseFromString 生成的XMLDOM节点属性去掉了原来的换行符等特殊符号,如何恢复?
- jquery pagination 无刷新分页问题!
- 使用Select来动态控制Img标签
- 怎样用JS控制表格行背景奇偶变化
- iframe非常难的一个问题!你能解决吗?请来看看吧。
- 如何请弹出窗口关闭后的返回参数?
- attachevent监听不到onchange事件
- ie8下,提交 $('#form1').ajaxSubmit(options)提交,提示拒绝访问
- javascript 动态写表格有些表格属性没出来,帮看看,谢谢!
- js 问题,请高手们来看看,帮我解决下
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<script>
function change(value)
{
if (value == "0")
{
document.getElementById("x2").disabled = false;
document.getElementById("x3").disabled = true;
}
else if (value == "1")
{
document.getElementById("x2").disabled = true;
document.getElementById("x3").disabled = false;
}
else
{
document.getElementById("x2").disabled = true;
document.getElementById("x3").disabled = true;
}
}
</script>
第一个下拉 <select name="x1" id="x1" onchange='javascript:change(this.options[this.selectedIndex].value)'>
<option value="0">0 </option>
<option value="1">1 </option>
<option value="2">2 </option>
</select>
第2个下拉 <select name="x2" id="x2" disabled>
<option value="0">0 </option>
<option value="2">1 </option>
<option value="3">2 </option>
</select>
第3个下拉 <select name="x3" id="x3" disabled>
<option value="0">0 </option>
<option value="1">1 </option>
<option value="2">2 </option>
</select>
</body>
</html>