<!doctype html>
<html lang="en">
<head>
<script language="JavaScript">
function setFun()
{
var id=new Array(1,2,3);
var value= new Array("北京","上海","广州");
var select=document.getElementById("area");
select.length=1;
select.option[0].selected=true;
for (var x=0; x<id.length ;x++ )
{
var option = document.createElement("option");
option.setAttribute("value",id[x]);
option.appendChild(document.createTextNode(value[x]));
select.appendChild(option);
}
}
</script>
<meta charset="UTF-8">
<meta name="Generator" content="EditPlus®">
<meta name="Author" content="">
<meta name="Keywords" content="">
<meta name="Description" content="">
<title>Document</title>
</head>
<body onLoad="setFun()"> 红色字体部分,为什么没有执行(IE11 、win8 os)
<form>
<select name="area" id="area">
<option value="0">没有地区</option>
</select>
</form>
</body>
</html>
|
|