亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

js獲取當前頁面路徑示例講解

 更新時間:2014年01月08日 09:59:19   作者:  
本篇文章主要是對js獲取當前頁面路徑的示例代碼進行了介紹,需要的朋友可以過來參考下,希望對大家有所幫助

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

設置或獲取整個 URL 為字符串。
<script>
alert(window.location.href);
</script>

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

設置或獲取 URL 的協(xié)議部分。
<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">

相關文章

最新評論