var t = document.getElementById("select1");
var selectValue=t.options[t.selectedIndex].value;//获取select的值
var t1 = document.getElementById("select2");
for(i=0;i
if(selectValue==t.options[i].value){
t1.options[i].selected=true
}
}
第二种方法,赋值是一样
0
1
2
function getSelectValue(){
var selectCount = document.getElementById("select1").options;
for(var i = 0 ; i
if(selectCount[i].selected){
alert(selectCount[i].value);
}
}
}
原文:https://www.cnblogs.com/KillBugMe/p/13162006.html