<html>
<body>
<select id="mySelect">
</select>
<p>单击该按钮可创建一个 OPTION 元素。</p>
<button onclick="myFunction()">试一试</button>
<p id="demo"></p>
<script>
function myFunction() {
var x = document.createElement("OPTION");
x.setAttribute("value", "volvocar");
var t = document.createTextNode("Volvo");
x.appendChild(t);
document.getElementById("mySelect").appendChild(x);
}
</script>
</body>
</html>