第一种:      
<script language="JavaScript" type="text/javascript">  
       window.location.href="login.jsp?backurl="+window.location.href;  
</script>

第二种:      
<script language="javascript">  
       alert("返回");  
       window.history.back(-1);     
</script>

第三种:     
<script language="javascript">  
       window.navigate("top.jsp");    
</script>


第四种: 
    
<script language="JavaScript">            
       self.location=’top.htm’;     
</script>

第五种:     
<script language="javascript">            
       alert("非法访问!");            
       top.location=’xx.jsp’;     
</script> 
 
=====javascript中弹出选择框跳转到其他页面=====  
<script language="javascript">  
<!--  
function logout()...{  
if (confirm("你确定要注销身份吗?是-选择确定,否-选择取消"))...{  
window.location.href="logout.asp?act=logout"  
}  
}  
-->  
</script> 
 
=====javascript中弹出提示框跳转到其他页面=====  
<script language="javascript">  
<!--  
function logout()...{  
alert("你确定要注销身份吗?");  
window.location.href="logout.asp?act=logout"  
}  
-->  
</script>

window.location="";和 location.replace("");有什么区别?

这两个都能让网页导向令一个网址,那么有什么区别呢?比如能带参数,不能带参数之类的.

Replace?还是Reload()?

好像没什么区别吧?没试过

replace(),reload()是重新加载本页,而replace()可以导向另外一个URL

给你举个例子:

我们现在有3个页面(a.html, b.html, c.html).

默认打开a.html页面,然后在a.html页面中通过一个链接转向a.html页面。

现在,我在b.html页面中用window.location.replace("c.html");与用window.location.href("c.html");分别进入c.html页面.

从用户界面来看是没有什么区别的,但是现在c.html页面有一个“返回”按钮,

用window.location.href("c.html");进入c.html页面时,

c.html页面中的调用window.history.Go(-1);wondow.history.back();进入c.html页面时,一点这个"返回"按钮就要返回b.html页面的话,

而如果用window.location.replace("c.html");进入c.html页面的话,

c.html页面中的调用window.history.go(-1);wondow.history.back();方法是不好用的,会返回到a.html.

因为window.location.replace("c.html");是不会向服务器发送请求而进行跳转,而window.history.go(-1);wondow.history.back();方法是根据服务器记录的请求决定该跳到哪个页面的,所以会跳到系统默认页面a.html 。

window.location.href("c.html");是向服务器发送请求的跳转,window.history.go(-1);wondow.history.back();方法是根据服务器记录的请求决定该跳到哪个页面的,所以就可以返回到b.html。

最新文章

  1. CF720F
  2. Python学习之变量
  3. python特殊函数 __len__(self):
  4. ERROR com.opensymphony.xwork2.interceptor.ParametersInterceptor.error:34 - Developer Notification
  5. 【分享】通过Excel生成批量SQL语句,处理大量数据的好办法
  6. VBA Excel 单元格操作
  7. NPOI心得
  8. hdu4055 dp
  9. 使用DataReader
  10. ng-book札记——路由
  11. 图像检索(5):基于OpenCV实现小型的图像数据库检索
  12. Config Server高可用
  13. G面经Prepare: Longest All One Substring
  14. 使用monitor.bat用DDMS查看其它项目的布局
  15. android 网络编程 HttpGet类和HttpPost类使用详解
  16. MongoDB一键安装(定制端口)
  17. Django设计模式
  18. EBS环境提交新请求默认是&quot;单一请求&quot;
  19. 《转载》Tomcat内存设置详解
  20. maven配置Mac平台

热门文章

  1. CentOS下配置Hadoop集群:java.net.NoRouteToHostException: No route to host问题的解决
  2. Fresco 源码分析(二) Fresco客户端与服务端交互(1) 解决遗留的Q1问题
  3. CentOS下源码安装mplayer播放器
  4. CodeIgniter - 数据库的增删改查
  5. wp8 入门到精通 ---时间
  6. 如何用SQL语句查询Excel数据?
  7. CDH中,执行HIVE脚本表联查权限问题。。
  8. Wp8—LongListSelector控件使用
  9. swift1.2语言函数和闭包函数介绍
  10. jsp错误解决办法