Default.aspx:
<asp:DropDownList ID="DropDownList1" runat="server">
<asp:ListItem Value="20">张三</asp:ListItem>
<asp:ListItem Value="21">李四</asp:ListItem>
<asp:ListItem Value="22">王五</asp:ListItem>
</asp:DropDownList>
<script type="text/javascript">
function showvalue(obj)
{
alert(obj.value);
}
</script>Default.aspx.cs:
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
DropDownList1.Attributes.Add("onchange", "showvalue(this);");
}
}
评论(0)
暂无评论。