2014-01-12 27 views

回答

0

您應該改用selectedIndex屬性。

舉例來說,如果你要選擇第三選項,使用

document.getElementById('ELEMENTNAME').selectedIndex = 2 //Index of the option. 

第六屆選項,使用

document.getElementById('ELEMENTNAME').selectedIndex = 5 //Index of the option. 
+0

謝謝,我已經完成了這個工作,並且它可以工作,但是我需要它根據選項的名稱而不是順序來選擇選項。謝謝 – user3155477

相關問題