动态增加select 选项
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script type="text/javascript">
window.onload=function(){
var ss=document.getElementById("sel");
var opt=document.createElement("option");
ss.options.add(new Option("湖南","3"),0); //加在最前
ss.options.add(new Option("浙江","4")); //加到最后
}
</script>
</head>
<body>
<form id="form1" name="form1" method="post" action="">
<label>
<select name="sel" id="sel">
<option value="1">广西</option>
<option value="2">广东</option>
</select>
</label>
</form>
</body>
</html>
浙公网安备 33010602011771号