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

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

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

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

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

設置或獲取與 URL 關聯(lián)的端口號碼。
<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">

相關文章

最新評論

左权县| 石城县| 广德县| 湄潭县| 乌海市| 高要市| 集贤县| 抚顺县| 海口市| 关岭| 林州市| 朔州市| 建始县| 阿拉善左旗| 珲春市| 昭苏县| 留坝县| 修文县| 金昌市| 通渭县| 独山县| 宁国市| 彭山县| 佛学| 张家川| 轮台县| 景洪市| 林口县| 麻栗坡县| 周至县| 许昌市| 荃湾区| 佳木斯市| 通海县| 克什克腾旗| 云安县| 徐汇区| 吕梁市| 和静县| 三原县| 岚皋县|