网站跳转汇总

  1. document.location

<html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> </head>
 <body>
     <b>document.location使用举例 </b ><p>
      <script type ="text/javascript">

         document.write( " 当前位置: " + document.location + " <p> " );
         document.write( " 当前位置的url路径: " + document.location.pathname + " <p> " );
         document.write( " 当前位置的url协议: " + document.location.protocol + " <p> " );
         document.write( " 当前位置的url端口: " + document.location.port + " <p> " );
         // 设置新的location
         document.location.href= " http://www.baidu.com " ; //直接跳转的
         // window.open('http://www.baidu.com');
      </script>
```
posted @ 2021-02-15 11:52  该显示昵称已被使用了  阅读(134)  评论(0)    收藏  举报