最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

js獲取當(dāng)前頁面路徑示例講解

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

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

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

設(shè)置或獲取與 URL 關(guān)聯(lián)的端口號碼。
<script>
alert(window.location.port)
</script>

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

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

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

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

網(wǎng)頁刷新推薦-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">

相關(guān)文章

最新評論

昭通市| 惠来县| 资兴市| 平乐县| 公主岭市| 缙云县| 哈尔滨市| 翁牛特旗| 衡山县| 库尔勒市| 金寨县| 灵川县| 寿宁县| 鄂州市| 惠来县| 江西省| 尤溪县| 万年县| 靖西县| 九龙城区| 海淀区| 专栏| 乌鲁木齐县| 巍山| 塔河县| 岑巩县| 新兴县| 昌图县| 大石桥市| 鹤庆县| 蕲春县| 丹凤县| 望城县| 常州市| 大港区| 贞丰县| 泰宁县| 英德市| 绥滨县| 太白县| 闽侯县|