【JS】简单的民族下拉菜单
<!DOCTYPE HTML>
<html>
<head>
<meta charset="UTF-8" />
<title>pro.html</title>
</head>
<body>
<select id="national">
<option>请选择</option>
</select>
<script type="text/javascript" src="jquery-1.8.0.min.js"></script>
<script type="text/javascript">
var national = [
"汉族", "壮族", "满族", "回族", "苗族", "维吾尔族", "土家族",
"彝族", "蒙古族", "藏族", "布依族", "侗族", "瑶族", "朝鲜族",
"白族", "哈尼族","哈萨克族", "黎族", "傣族", "畲族", "傈僳族",
"仡佬族", "东乡族", "高山族", "拉祜族", "水族", "佤族", "纳西族",
"羌族", "土族", "仫佬族", "锡伯族","柯尔克孜族", "达斡尔族", "景颇族",
"毛南族", "撒拉族", "布朗族", "塔吉克族", "阿昌族", "普米族", "鄂温克族",
"乌孜别克族", "门巴族", "鄂伦春族", "独龙族", "塔塔尔族", "赫哲族", "珞巴族"
];
window.onload=function(){
var nat=document.getElementById("national");
for( var i=0; i<national.length;i++){
var option=document.createElement('option');
option.value=i;
var txt=document.createTextNode(national[i]);
option.appendChild(txt);
nat.appendChild(option);
}
}
</script>
</body>
</html>