第三十七节 JavaScript中的window.location属性一

 1 <!-- window.location.href 获取或者重定url地址
 2      window.location.search 获取地址参数部分
 3      window.location.hasd 获取页面锚点或者叫哈希值 -->
 4 <!DOCTYPE html>
 5 <html lang="en">
 6 <head>
 7     <meta charset="UTF-8">
 8     <title>Document</title>
 9     <script type="text/javascript">
10         window.onload = function(){
11             var oBtn01 = document.getElementById('btn01');
12             oBtn01.onclick = function(){
13                 window.location.href = 'http://www.baidu.com';
14             }
15         }
16 
17     </script>
18 </head>
19 <body>
20     <input type="button" name="" value="跳转" id="btn01">
21 </body>
22 </html>

 

posted @ 2020-03-14 17:19  kog_maw  阅读(146)  评论(0编辑  收藏  举报