<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<script type="text/javascript">
function myfun() {
var data=[{"name":1,"value":"A"},
{"name":2,"value":"B"},
{"name":3,"value":"C"}]
var s= document.getElementById("s");
for(var i=0;i<data.length;i++){
s.options.add(new Option(data[i].value,data[i].name));
}
}
window.onload = myfun;
</script>
</head>
<body>
<select id="s"></select>
</body>
</html>
js select option
最新推荐文章于 2022-11-17 14:23:33 发布