用window.location.href实现页面跳转
来源:互联网 发布:中国古代性知乎 编辑:程序博客网 时间:2024/05/14 18:39
在写ASP.Net程序的时候,我们经常遇到跳转页面的问题,我们经常使用Response.Redirect ,如果客户要在跳转的时候使用提示,这个就不灵光了,如:
Response.Write("<script>alert('恭喜您,注册成功!');</script>");
Response.Redirect("main.html");
这时候我们的提示内容没有出来就跳转了,和Response.Redirect("main.html");没有任何区别。
这时我们采用下面代码试验一下:
Response.Write("<script language=javascript>alert('恭喜您,注册成功!')</script>");
Response.Write("<script language=javascript>window.location.href='main.html'</script>");
这个即实现了我们的要求,在提示后,跳转页面。
最重要的是window.location.href 语句可以实现一个框架的页面在执行服务器端代码后刷新另一个框架的页面(Response.Redirect无法达到,至少我没有发现):
如:index.htm页面中有二个框架,分别为 frameLeft和frameRight,在frameRight页面中执行服务器端代码后刷新frameLeft中的页面。
先前最常见的是注册之后,自动刷新登陆框,让登陆框换成已登陆页面,只要在注册成功的代码之后加上一段,即可以实现刷新另个框架的页面。代码如下:
Response.Write("<script language=javascript>alert('恭喜您,注册成功!')</script>");
Response.Write("<script language=javascript>window.parent.frameLeft.location.href='main.html'</script>");
Response.Write("<script>alert('恭喜您,注册成功!');</script>");
Response.Redirect("main.html");
这时候我们的提示内容没有出来就跳转了,和Response.Redirect("main.html");没有任何区别。
这时我们采用下面代码试验一下:
Response.Write("<script language=javascript>alert('恭喜您,注册成功!')</script>");
Response.Write("<script language=javascript>window.location.href='main.html'</script>");
这个即实现了我们的要求,在提示后,跳转页面。
最重要的是window.location.href 语句可以实现一个框架的页面在执行服务器端代码后刷新另一个框架的页面(Response.Redirect无法达到,至少我没有发现):
如:index.htm页面中有二个框架,分别为 frameLeft和frameRight,在frameRight页面中执行服务器端代码后刷新frameLeft中的页面。
先前最常见的是注册之后,自动刷新登陆框,让登陆框换成已登陆页面,只要在注册成功的代码之后加上一段,即可以实现刷新另个框架的页面。代码如下:
Response.Write("<script language=javascript>alert('恭喜您,注册成功!')</script>");
Response.Write("<script language=javascript>window.parent.frameLeft.location.href='main.html'</script>");
- 用window.location.href实现页面跳转
- 用window.location.href实现页面跳转
- 用window.location.href实现页面跳转
- window.location.href页面跳转
- location.href、parent.location.href、top.location.href、 window.open实现页面跳转
- location.href、parent.location.href、top.location.href、 window.open实现页面跳转
- location.href、parent.location.href、top.location.href、 window.open实现页面跳转
- location href、parent location href、top location href、window open实现页面跳转
- location.href、parent.location.href、top.location.href、 window.open实现页面跳转
- location href、parent location href、top location href、window open实现页面跳转
- ASP.Net中使用 window.location.href 实现页面跳转
- 页面跳转重载window.location.href
- window对象的属性和方法 window.location.href实现页面跳转
- 用window.location.href实现刷新另个框架页面
- 用window.location.href实现刷新另个框架页面
- 用window.location.href实现刷新另个框架页面
- 用window.location.href实现刷新另个框架页面
- 用window.location.href实现刷新另个框架页面
- sql2005登录的时候出现的错误解决方法
- 下拉列表框操作--高级操作部分二
- Mysql调优------实用
- 对字符串进行url编码其实
- java数据结构之单链表(添加尾指针)
- 用window.location.href实现页面跳转
- 删除无效的SQL SERVER组的几种方法
- 学了一整struts实在不知道它能做什么
- Windows上VIM的 exrc vimrc 在哪里?
- .NET 编程技巧点滴
- CSS DIV自适应高度布局
- Hibernate入门
- KEEP IT SIMPLE, STUPID!
- GIS开源程序收集