html有两个下拉框要求如下:
2个回答
展开全部
<body>
<script>
function query(){
if(document.getElementById("select1").value=='a'){
document.getElementById("id2").style.display='none';
}else{
document.getElementById("id2").style.display='';
}
}
</script>
<tr>
<td>
<select id="select1" name="select" onchange="query();">
<option>请选择</option>
<option value="a">a</option>
<option value="b">b</option>
</select>
<span id="id2">
<select id="select2" name="select">
<option>请选择</option>
<option>c</option>
<option>d</option>
</select>
</span>
</td>
<tr>
</body>
<script>
function query(){
if(document.getElementById("select1").value=='a'){
document.getElementById("id2").style.display='none';
}else{
document.getElementById("id2").style.display='';
}
}
</script>
<tr>
<td>
<select id="select1" name="select" onchange="query();">
<option>请选择</option>
<option value="a">a</option>
<option value="b">b</option>
</select>
<span id="id2">
<select id="select2" name="select">
<option>请选择</option>
<option>c</option>
<option>d</option>
</select>
</span>
</td>
<tr>
</body>
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
我给你做了个样例,是用jquery搞的,很简单的:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<script type="text/javascript" src="jquery-1.3.2.min.js"></script>
<title> New Document </title>
<meta name="Generator" content="EditPlus">
<meta name="Author" content="">
<meta name="Keywords" content="">
<meta name="Description" content="">
</head>
<script>
function change(){
var val = $("#first").val();
if(val == "a"){
$("#second").hide();
}else if(val == "b"){
$("#second").show();
}
}
</script>
<body>
<select id="first" onchange="change()">
<option value="a">a</option>
<option value="b" selected>b</option>
</select>
<select id="second">
<option value="a">a</option>
<option value="b">b</option>
</select>
</body>
</html>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<script type="text/javascript" src="jquery-1.3.2.min.js"></script>
<title> New Document </title>
<meta name="Generator" content="EditPlus">
<meta name="Author" content="">
<meta name="Keywords" content="">
<meta name="Description" content="">
</head>
<script>
function change(){
var val = $("#first").val();
if(val == "a"){
$("#second").hide();
}else if(val == "b"){
$("#second").show();
}
}
</script>
<body>
<select id="first" onchange="change()">
<option value="a">a</option>
<option value="b" selected>b</option>
</select>
<select id="second">
<option value="a">a</option>
<option value="b">b</option>
</select>
</body>
</html>
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询