如何獲取html下拉選單中被選中的項的值?akaau96132019-11-05 19:37:02

var obj = document。getElementById(“DropDownListID”)

;obj。options[obj。selectedIndex]。value就是你所選擇的值。該問題還有一種方法如下:

this。Label1。Text=DropDownList1。SelectedValue。ToString();}把DropDownList1的AutoPostBack的屬性改為true。