添加 option。
<select>
<option value="aaa">123</option>
<option value="bbb">456</option>
</select>
<button onclick="myOption=document.getElementsByTagName('select')[0];myOption.options[myOption.options.length]=new Option('guoshuangText','guoshuangValue')">add option</button>


删除 option 在 firefox 是 select.remove(selectedIndex),而不是 options.remove()
输出 option[x].innerText 在 firefox 下用 options[x].textContent(firefox没有innerText,就是用textContent 来替代的)
<select onchange="alert(this[selectedIndex].textContent)">
<option value="aaa">123</option>
<option value="bbb">456</option>
</select>

posted on 2007-10-29 17:14  大口仔  阅读(1549)  评论(0编辑  收藏  举报

使用Live Messenger联系我
关闭