獲取顯示的漢字
document.getElementById("bigclass").options[window.document.getElementById("bigclass").selectedIndex].text
獲取數據庫中的id
window.document.getElementById("bigclass").value
獲取select組分配的索引id
window.document.getElementById("bigclass").selectedIndex
例子:
<select name="bigclass" id="bigclass" onChange="javascript:updatePage2();">
<option value="" selected="selected">ajax實驗</option>
<option value="4">我適宜市哈</option>
</select>
使用
document.getElementById("bigclass").options[window.document.getElementById("bigclass").selectedIndex].text
的結果是:我適宜市哈
使用
window.document.getElementById("bigclass").value
的結果是:4
使用
window.document.getElementById("bigclass").selectedIndex
的結果是:1
J-CN工作室
www.j-cn.org