日期:2014-05-19  浏览次数:20419 次

急急!!求解一个asp.net中页面跳转问题?
求解一个asp.net中页面跳转问题?  

我的页面上有一个下拉列表框,我想在下拉列表框中选中哪个网址,就跳转到到哪个网站,但不能关闭当前页面!比如,我选百度,就跳转到(www.baidu.com)请问代码怎么写?    
我试过Me.Response.Redirect( "www.baidu.com ",false)这个不行。但是我不想用window.open()弹出,请问我该怎么写???急急急急啊!!!

------解决方案--------------------
<script type= 'text/jscript '> 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>
------解决方案--------------------
Me.Response.Redirect( "www.baidu.com ",false)不会新开窗口的,只能在客户端做。
或者不要提交到服务器,直接在客户端执行
<select onchange= "window.open(this.value) ">
<option value= "http://xxx ">
------解决方案--------------------
幕白兄厉害
------解决方案--------------------
大家太强了
------解决方案--------------------
幫頂﹐學習
------解决方案--------------------
up
------解决方案--------------------
<html xmlns= "http://www.w3.org/1999/xhtml " >
<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>
------解决方案--------------------
来晚了~~
都结贴了,再帮顶一下!!!