如何獲取html下拉選單中被選中的項的值?
akaau9613 發表于 文化2022-09-15
var obj = document。getElementById(“DropDownListID”)
;obj。options[obj。selectedIndex]。value就是你所選擇的值。該問題還有一種方法如下:
this。Label1。Text=DropDownList1。SelectedValue。ToString();}把DropDownList1的AutoPostBack的屬性改為true。