<script language="C#" runat="server">
void Page_Load(Object src , EventArgs e)
{
DropDown1.Items.Add(new ListItem("ASP.Net区","ASP.Net"));
DropDown1.Items.Add(new ListItem("JSP区","JSP"));
DropDown1.Items.Add(new ListItem("C#区","C#"));
DropDown1.Items.Add(new ListItem("PHP区","PHP"));
DropDown1.Items.Add(new ListItem("VBVC区","VBVC"));
DropDown1.Items.Add(new ListItem("HTML区","HTML"));
}
void SubmitBtn_Click(Object Sender, EventArgs e)
{
string SelectedText = DropDown1.SelectedItem.Text;
string SelectedValue = DropDown1.SelectedItem.Value;
Label1.Text="您选择的讨论区是:<font color=red>"+SelectedText+"<br></font>值为:<font color=red>"+SelectedValue+"</font>";
}
</script>
<html>
<head>
</head>
<body>
<b><font face="Verdana">DropDownList 示例</font></b>
<form runat=server>
<asp:DropDownList id=DropDown1 runat="server" />
<asp:button text="选择" OnClick="SubmitBtn_Click" runat=server/>
<p>
<asp:Label id=Label1 font-size="10pt" runat="server">
请选择一个讨论区
</asp:Label>
</form>
</body>
</html>
posted on 2006-04-03 14:04
汪杰 阅读(169)
评论(0) 编辑 收藏 引用 所属分类:
hengxing网站js