首页 > 其他 > 详细

location的用法

时间:2015-11-13 13:12:00      阅读:201      评论:0      收藏:0      [点我收藏+]
 1 <!doctype html>
 2 <html lang="en">
 3 <head>
 4     <meta charset="UTF-8">
 5     <title></title>
 6 </head>
 7 <body>
 8 <script>
 9     console.log(location.href);
10     console.log(location.protocol);
11     console.log(location.host);
12     console.log(location.port);
13     console.log(location.pathname);
14 //    问号后面的内容,包括问号
15  console.log(location.search);
16 //    #号后面的内容,包括#
17     console.log(location.hash);
18 //    加载新页面;不知道与window.open()的区别;
19     location.assign("http://www.baidu.com")
20 //    重新刷新当前页面
21     location.reload()
22 </script>
23 </body>
24 </html>

 

location的用法

原文:http://www.cnblogs.com/suoking/p/4961743.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!