比如 <select name="select" id="1" onchange="a()">
<option>晴</option>
<option>多云</option>
</select> <select name="select2" id="2">
<option>晴</option>
<option>多云</option>
</select>
我选择多云时,第二个也要变成多云,里面的a()函数怎么写
<option>晴</option>
<option>多云</option>
</select> <select name="select2" id="2">
<option>晴</option>
<option>多云</option>
</select>
我选择多云时,第二个也要变成多云,里面的a()函数怎么写
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script>
window.onload=function(){
document.getElementById("1").onchange=function()
{
var select2=document.getElementById("2");
select2.selectedIndex=document.getElementById("1").selectedIndex;
}
}
</script>
</head><body>
<select name="select" id="1" onchange="a()">
<option>晴 </option>
<option>多云 </option>
</select> <select name="select2" id="2">
<option>晴 </option>
<option>多云 </option>
</select>
</body>
</html>
window.onload=function(){
document.getElementById("1").onchange=function()
{
var select2=document.getElementById("2");
select2.selectedIndex=document.getElementById("1").selectedIndex;
}
}
</script><select name="select" id="1">
<option>晴 </option>
<option>多云 </option>
</select> <select name="select2" id="2">
<option>晴 </option>
<option>多云 </option>
</select>