我知道改變一個輸入文本的值。如何將值添加到空白SELECT?
<script>
document.write('<input type="text" id="1" value="Hello">');
document.getElementById('1').value = ("Good bye");
</script>
如何使用此方法將值添加到空的SELECT?
<script>
document.write('<select><option id="2"></option><option id="3"></option></select>');
document.getElementById ........;
</script>
我想讓我的空SELECT成爲一個帶有兩個選項的SELECT:「Hello」和「Good Bye。」。
你已經有了select元素嗎?那是你在說什麼? –