新手JS在這裏,我需要從10個城市的數組中填充下拉列表,我只是無法獲得任何代碼工作。初學者Javascript陣列下拉列表
<select id="selectCity">
<option>Choose a City</option>
</select>
var select = document.getElementById('selectCity');
var options = ["Winthrop","Revere","Malden","East Boston","Medford","Somerville","South Boston","Quincy","Malden","Weymouth"];
//what code will work in this loop below???
for(var i = 0; i < options.length; i++) {
}
http://stackoverflow.com/questions/8674618/adding-options-to-select-with-javascript – sinisake