日期:2014-05-16 浏览次数:20457 次
<select onchange = "op(this)">
<option value="" selected="selected"></option>
<option value="1">第一组</option>
</select>
<select id="sel">
</select>
<script type="text/javascript">
var a = ["aa","bb","cc"];
var op = function(h){
var sub = document.getElementById("sel");
var set = function(){
var frage = document.createDocumentFragment();
for(var i=0,len=a.length;i<len;i++){
var o = document.createElement("option");
o.value = a[i];
o.text = a[i];
frage.appendChild(o);
}
sub.appendChild(frage);
};
sub.innerHTML = "";
if(h.value == "1") set()
};
</script>