求助,2个下拉框联动,如何修改成我选择第一个下拉框的内容后 第二个下拉框同步显示一样的内容? 20
<html><head><title>Thisisatest!</title></head><body><selectname="name1"id="id1"><opti...
<html>
<head>
<title>This is a test!</title>
</head>
<body>
<select name="name1" id="id1">
<option value="请选择" selected>请选择</option>
<option value="1">脚本语言</option>
<option value="2">高级语言</option>
<option value="3">其他语言</option>
</select>
<select name="name2" id="id2">
<option value="请选择" selected>请选择</option>
<option value="1">脚本语言</option>
<option value="2">高级语言</option>
<option value="3">其他语言</option>
</select>
</form>
</body>
</html> 展开
<head>
<title>This is a test!</title>
</head>
<body>
<select name="name1" id="id1">
<option value="请选择" selected>请选择</option>
<option value="1">脚本语言</option>
<option value="2">高级语言</option>
<option value="3">其他语言</option>
</select>
<select name="name2" id="id2">
<option value="请选择" selected>请选择</option>
<option value="1">脚本语言</option>
<option value="2">高级语言</option>
<option value="3">其他语言</option>
</select>
</form>
</body>
</html> 展开
1个回答
展开全部
<HTML>
<HEAD>
<TITLE> test </TITLE>
<SCRIPT TYPE="text/javascript" LANGUAGE="JavaScript">
function TB() {
document.getElementById("TongBu").innerHTML="<select name='name2' id='id2'>" + document.getElementById("id1").innerHTML +"</select>";
}
</SCRIPT>
</HEAD>
<BODY>
<select name="name1" id="id1" onchange="TB();">
<option value='请选择' selected>请选择</option>
<option value=1>脚本语言</option>
<option value=2>高级语言</option>
<option value=3>其他语言</option>
</select>
<Div id='TongBu'>
</Div>
</BODY>
</HTML>
<HEAD>
<TITLE> test </TITLE>
<SCRIPT TYPE="text/javascript" LANGUAGE="JavaScript">
function TB() {
document.getElementById("TongBu").innerHTML="<select name='name2' id='id2'>" + document.getElementById("id1").innerHTML +"</select>";
}
</SCRIPT>
</HEAD>
<BODY>
<select name="name1" id="id1" onchange="TB();">
<option value='请选择' selected>请选择</option>
<option value=1>脚本语言</option>
<option value=2>高级语言</option>
<option value=3>其他语言</option>
</select>
<Div id='TongBu'>
</Div>
</BODY>
</HTML>
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询