<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
</head>
<body>
<select id="list" runat="server">
<script type="text/javascript">
var s = document.getElementById("list");
for (var i = 0; i < 6; i++) {
var option = document.createElement("option");
option.setAttribute("value", i);
option.appendChild(document.createTextNode(i));
s.options.add(option);
}
</script>
</select>
</body>
</html>
js代码一定要写到 <select>标签的下面 |