我有一個下拉如何在javascript中的下拉列表中預先選擇一個選項?
if (chosen == "Parade") {
selbox.options[selbox.options.length] = new Option("Select Venue","");
selbox.options[selbox.options.length] = new Option("Benavides Park","Benavides Park");
selbox.options[selbox.options.length] = new Option("CME Auditorium","CME Auditorium");
selbox.options[selbox.options.length] = new Option("Engineering Sports Complex","Engineering Sports Complex");
selbox.options[selbox.options.length] = new Option("Field in front of Grandstand","Field in front of Grandstand");
selbox.options[selbox.options.length] = new Option("Plaza Mayor","Plaza Mayor");
selbox.options[selbox.options.length] = new Option("Quadricentennial Park","Quadricentennial Park");
selbox.options[selbox.options.length] = new Option("Rectors Hall","Rectors Hall");
selbox.options[selbox.options.length] = new Option("Seminary Gym","Seminary Gym");
selbox.options[selbox.options.length] = new Option("Tinoco Park","Tinoco Park");
selbox.options[selbox.options.length] = new Option("UST Grandstand","UST Grandstand");
selbox.options[selbox.options.length] = new Option("UST Gymnasium","UST Gymnasium");
selbox.options[selbox.options.length] = new Option("Venue not listed/outside UST","Venue not listed/outside UST");
}
什麼是選項「貝納維德斯園」爲默認值的代碼這個代碼? 在HTML是這樣的
selected="selected"
怎麼樣在JavaScript?
檢出此問題http://stackoverflow.com/questions/149573/check-if-option-is-selected-with-jquery-if-not-select-a - 默認 – eKek0 2009-10-12 22:13:08