亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

location地址欄對(duì)象

Location地址欄對(duì)象

  • href:獲取地址欄中完整的地址??梢詫?shí)現(xiàn)JS的網(wǎng)頁跳轉(zhuǎn)。location.href = “http://www.sina.com.cn”;

  • hostname:主機(jī)名

  • pathname:文件路徑及文件名

  • search:查詢字符串。

  • protocol:協(xié)議,如:http://、ftp://

  • hash:錨點(diǎn)名稱。如:#top

  • reload([true]):刷新網(wǎng)頁。true參數(shù)表示強(qiáng)制刷新

注意:所有的屬性,重新賦值后,網(wǎng)頁將自動(dòng)刷新。

<!DOCTYPE HTML>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
        <title>php.cn</title>
        <script type="text/javascript">
            //實(shí)例:測試不同瀏覽器
            var str = "<h2>地址欄對(duì)象</h2>";
            str += "地址欄地址:"+location.href;
            str += "<br>主機(jī)名:"+location.hostname;
            str += "<br>文件路徑及文件名:"+location.pathname;
            str += "<br>協(xié)議:"+location.protocol;
            document.write(str+"<hr>");
        </script>
    </head>
    <body >
    </body>
</html>


繼續(xù)學(xué)習(xí)
||
<!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>php.cn</title> <script type="text/javascript"> //實(shí)例:測試不同瀏覽器 var str = "<h2>地址欄對(duì)象</h2>"; str += "地址欄地址:"+location.href; str += "<br>主機(jī)名:"+location.hostname; str += "<br>文件路徑及文件名:"+location.pathname; str += "<br>協(xié)議:"+location.protocol; document.write(str+"<hr>"); </script> </head> <body > </body> </html>
提交重置代碼