Response.Redirect 如何用jquery来写

zhengyingcan 2016-02-25 08:29:17
WEBFORM 的原代码如下

AB2.Attributes.Add("onclick", "this.form.target='top'");//可以让页面新开一个页面出来

protected void AB2_Click(object sender, EventArgs e)
{
string ID = lblID.Text;
Response.Redirect("Pbuyamodelrdlc.aspx?ID=" + ID);
}

以上用jquery 来写, 该怎么写呢
...全文
329 15 打赏 收藏 举报
写回复
用AI写文章
15 条回复
切换为时间正序
请发表友善的回复…
发表回复
scboy2012 2016-02-29
  • 打赏
  • 举报
回复
window.open("url")
u014548735 2016-02-25
  • 打赏
  • 举报
回复
引用 2 楼 zhengyingcan 的回复:
[quote=引用 1 楼 wanghui0380 的回复:] //不太清楚你具体要求,所以姑且认为是top的location转向,同时lblID的clientid你自己来,我只表示一下大概写法 window.top.location="xxxxx.aspx?id"+$('#lblIdCientid').text()
是不是 AB2.top.location="xxxxx.aspx?id"+$('#lblIdCientid').text() 这样子写,感觉不行, 能不能类似如下 $(document).ready(function () { $("#AB2").click ( function () { "xxxxx.aspx?id"+$('#lblIdCientid').text() }[/quote] $(document).ready(function () { $("#AB2").click ( function () { location.href = "/xxxxx.aspx?id"+$('#lblIdCientid').text() ; }
xdashewan 2016-02-25
  • 打赏
  • 举报
回复
把你自己写的click事件和1楼的跳转代码结合一下就是了
引用 8 楼 zhengyingcan 的回复:
能不能给个案例呀,谢谢
zhengyingcan 2016-02-25
  • 打赏
  • 举报
回复
引用 3 楼 xdashewan 的回复:
既然要用jquery来写就无需提交服务器,直接用jquery写一个按钮点击事件就行
能不能给个案例呀,谢谢
EdsionWang 2016-02-25
  • 打赏
  • 举报
回复
赞同3#的看法,就一个页面跳转,直接前台脚本弄好了。为什么要走后台转一圈呢
zhengyingcan 2016-02-25
  • 打赏
  • 举报
回复
引用 5 楼 hanjun0612 的回复:
1#正解。 window.top.location="页面" 后面的参数,通过jquery获取文本框内容,拼接上去
单击按钮才跳转, 没有看到有 click 事件
正怒月神 版主 2016-02-25
  • 打赏
  • 举报
回复
1#正解。 window.top.location="页面" 后面的参数,通过jquery获取文本框内容,拼接上去
xdashewan 2016-02-25
  • 打赏
  • 举报
回复
既然要用jquery来写就无需提交服务器,直接用jquery写一个按钮点击事件就行
xiaoqiu_net 2016-02-25
  • 打赏
  • 举报
回复
window.location.href="xx.aspx" 直接跳转了
zhengyingcan 2016-02-25
  • 打赏
  • 举报
回复
引用 1 楼 wanghui0380 的回复:
//不太清楚你具体要求,所以姑且认为是top的location转向,同时lblID的clientid你自己来,我只表示一下大概写法 window.top.location="xxxxx.aspx?id"+$('#lblIdCientid').text()
是不是 AB2.top.location="xxxxx.aspx?id"+$('#lblIdCientid').text() 这样子写,感觉不行, 能不能类似如下 $(document).ready(function () { $("#AB2").click ( function () { "xxxxx.aspx?id"+$('#lblIdCientid').text() }
wanghui0380 2016-02-25
  • 打赏
  • 举报
回复
//不太清楚你具体要求,所以姑且认为是top的location转向,同时lblID的clientid你自己来,我只表示一下大概写法 window.top.location="xxxxx.aspx?id"+$('#lblIdCientid').text()
zhengyingcan 2016-02-25
  • 打赏
  • 举报
回复
目的是 location.href 从一个新的窗口打开
zhengyingcan 2016-02-25
  • 打赏
  • 举报
回复
引用 12 楼 guwei4037 的回复:
在window.location.href中不能用target,要把target=blank这段去掉。
去掉,不能有一个新的窗口
全栈极简 2016-02-25
  • 打赏
  • 举报
回复
在window.location.href中不能用target,要把target=blank这段去掉。
zhengyingcan 2016-02-25
  • 打赏
  • 举报
回复
为了新窗口打开,我改成如下 <script type="text/javascript" src="../Js/jquery-1.8.2.js"></script> <script type="text/javascript" > $(document).ready(function () { $("#AB2").click ( function () { var lblid = $("#lblID").text(); location.href = "Pbuyamodelrdlc.aspx?ID=" + lblid+" target='_blank'"; } ); }); </script> 'target' 附近有语法错误。

62,270

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧