<script> var gSelectID = ["123","456",'789']; for (var i in gSelectID) { var selectID = document.getElementById("selectID"); var option = document.createElement("option");// 创建option元素 option.appendChild(document.createTextNode(gSelectID[i])); option.setAttribute("value", gSelectID[i]); selectID.appendChild(option); }