国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

location對象

location對象表示當前頁面的URL信息。例如,一個完整的URL:

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

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

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'

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

location 對象屬性:

QQ截圖20161012171542.png

location 對象方法:

QQ截圖20161012171548.png

繼續(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("當前網(wǎng)址:"+myurl); </script> </head> <body> </body>
提交重置代碼