JS重定向url几种法方

   第一种: 
    <script type="text/javascript"> 
           window.location.href="http:\\www.baidu.com";   //会记载入history对象中,可以返回
       window.location.replace ( "http:\\www.baidu.com" );    //不会记载入history对象中
       window.location.hash = "#moreResults";   //跳转到锚点
</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>

第六种
  <script language="javascript">
    location.assign("http://www.baidu.com");  //location.assign(url); 加载新的文档
  </script>

 

posted @ 2015-10-20 10:30  暗夜心慌方  阅读(7092)  评论(0)    收藏  举报