怎样在客户端得到页面上的dropdownlist当前选中的项目的文字?
马鸣风萧萧 2004-04-11 11:04:17 我在asp.net服务器页面上放了一个web控件dropdownlist:
<asp:DropDownList id="DropDownList1" runat="server" Width="240px" Height="16px" AutoPostBack="True">
<asp:ListItem Value="2" Selected="True">小王</asp:ListItem>
<asp:ListItem Value="3">小昕</asp:ListItem>
<asp:ListItem Value="1">小张</asp:ListItem>
</asp:DropDownList>
现在想在客户端取得下拉框的当前值--text,而不是value,该如何得到?急!!
<script language="javascript">
function intial()
{
GetDropDownList();
}
function GetDropDownList()
{
var str = document.all.DropDownList1.value ;
alert(str);
}
</script>