62,267
社区成员
发帖
与我相关
我的任务
分享 <form id="form1" runat="server">
<div>
<asp:DropDownList ID="DropDownList1" runat="server"
onselectedindexchanged="DropDownList1_SelectedIndexChanged" AutoPostBack="true">
<asp:ListItem Text="请选择" Value=""></asp:ListItem>
<asp:ListItem Text="博客园" Value="http://www.cnblogs.com"></asp:ListItem>
<asp:ListItem Text="CSDN" Value="http://bbs.csdn.net/"></asp:ListItem>
</asp:DropDownList>
</div>
</form> protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
string url = DropDownList1.SelectedValue;
if (!string.IsNullOrEmpty(url) && (Session["Url"] == null || Session["Url"].ToString() != url))
{
Session["Url"] = url;
Page.RegisterStartupScript("打开", "<script language=javascript>window.open('" + url + "','_blank');</script>");
}
} <form id="form1" runat="server">
<div>
<asp:DropDownList ID="DropDownList1" runat="server"
onselectedindexchanged="DropDownList1_SelectedIndexChanged" AutoPostBack="true">
<asp:ListItem Text="请选择" Value=""></asp:ListItem>
<asp:ListItem Text="博客园" Value="http://www.cnblogs.com"></asp:ListItem>
<asp:ListItem Text="CSDN" Value="http://bbs.csdn.net/"></asp:ListItem>
</asp:DropDownList>
</div>
</form> protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
string url = DropDownList1.SelectedValue;
Page.RegisterStartupScript("打开", "<script language=javascript>window.open('" + url + "','_blank');location.href=location.href</script>");
}