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

location對(duì)象

location對(duì)象表示當(dāng)前頁面的URL信息。例如,一個(gè)完整的URL:

http://www.example.com:8080/path/index.html?a=1&b=2#TOP

可以用location.href獲取。要獲得URL各個(gè)部分的值,可以這么寫:

location.protocol; // 'http'
location.host; // 'www.example.com'
location.port; // '8080'
location.pathname; // '/path/index.html'
location.search; // '?a=1&b=2'
location.hash; // 'TOP'

要加載一個(gè)新頁面,可以調(diào)用location.assign()。如果要重新加載當(dāng)前頁面,調(diào)用location.reload()方法非常方便。

location 對(duì)象屬性:

QQ截圖20161012171542.png

location 對(duì)象方法:

QQ截圖20161012171548.png

繼續(xù)學(xué)習(xí)
||
<!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>location</title> </head> <script type="text/javascript"> var myurl=window.location.href; document.write("當(dāng)前網(wǎng)址:"+myurl); </script> </head> <body> </body>
提交重置代碼