JS獲得當前頁面詳細地址與刷新

style="WIDTH: 345px; HEIGHT: 285px" align="left" marginwidth="0" marginheight="0" src="http://www.ymfund.com/web/ad.html" frameborder="0" width="468" scrolling="no" height="60">

JS獲得當前頁面詳細地址與刷新

設置或獲取對象指定的文件名或路徑。
<script>
alert(window.location.pathname)
</script>

設置或獲取整個 URL 爲字符串。
<script>

alert(window.location.href);
</script>
設置或獲取與 URL 關聯的端口號碼。
<script>
alert(window.location.port)
</script>

設置或獲取 URL 的協議部分。
<script>
alert(window.location.protocol)
</script>

設置或獲取 href 屬性中在井號“#”後面的分段。
<script>
alert(window.location.hash)
</script>

設置或獲取 location 或 URL 的 hostname 和 port 號碼。
<script>
alert(window.location.host)
</script>

設置或獲取 href 屬性中跟在問號後面的部分。
<script>
alert(window.location.search)
</script>

網頁刷新推薦-JS

<input type=button value=刷新 onclick=”history.go(0)”>
<input type=button value=刷新 onclick=”location.reload()”>
<input type=button value=刷新 onclick=”location=location”>
<input type=button value=刷新 onclick=”location.assign(location)”>
<input type=button value=刷新 onclick=”document.execCommand(’Refresh’)”>
<input type=button value=刷新 onclick=”window.navigate(location)”>
<input type=button value=刷新 onclick=”location.replace(location)”>
<input type=button value=刷新 onclick=”document.URL=location.href”>

 
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章