求解一个asp.net中页面跳转问题? 我的页面上有一个下拉列表框,我想在下拉列表框中选中哪个网址,就跳转到到哪个网站,但不能关闭当前页面!比如,我选百度,就跳转到(www.baidu.com)请问代码怎么写?
我试过Me.Response.Redirect("www.baidu.com",false)这个不行。但是我不想用window.open()弹出,请问我该怎么写???急急急急啊!!!
我试过Me.Response.Redirect("www.baidu.com",false)这个不行。但是我不想用window.open()弹出,请问我该怎么写???急急急急啊!!!
function GoNav(ddl)
{
var a =document.createElement("A");
a.target = "_new";
a.href = ddl.value;
a.style.display = "none";
document.body.appendChild(a);
a.click();
}
</script> <asp:DropDownList ID="ddlDropDownList" onchange="javascript:GoNav(this);" runat="server">
<asp:ListItem Value=" "></asp:ListItem>
<asp:ListItem Value="http://www.sina.com.cn">sina</asp:ListItem>
</asp:DropDownList>
或者不要提交到服务器,直接在客户端执行
<select onchange="window.open(this.value)">
<option value="http://xxx">
<option value="http://xxx">
<head runat="server">
<title>无标题页</title>
<script type='text/jscript'>
function GoNav(sel)
{
var alink = document.getElementById('newWin');
alink.href = sel.value;
alink.click();
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:DropDownList ID="selUrl" onchange="javascript:GoNav(this);" runat="server">
<asp:ListItem Value=" ">请选择地址</asp:ListItem>
<asp:ListItem Value="http://www.sina.com.cn">百度</asp:ListItem>
<asp:ListItem Value="http://www.sina.com.cn">新浪</asp:ListItem>
</asp:DropDownList>
<a href="#" style="display:none" target="_blank" id="newWin"></a>
</div>
</form>
</body>
</html>