js獲取當(dāng)前地址 JS獲取當(dāng)前URL的示例代碼
更新時(shí)間:2014年02月26日 10:10:38 作者:
本篇文章主要是對(duì)js獲取當(dāng)前地址 JS獲取當(dāng)前URL的示例代碼進(jìn)行了介紹,需要的朋友可以過(guò)來(lái)參考下,希望對(duì)大家有所幫助
復(fù)制代碼 代碼如下:
<table width=100% cellpadding=0 cellspacing=0 border=0 >
<script language="javascript">
thisURL = document.URL;
thisHREF = document.location.href;
thisSLoc = self.location.href;
thisDLoc = document.location;
strwrite = "<tr><td valign=top>thisURL: </td><td>[" + thisURL + "]</td></tr>"
strwrite += "<tr><td valign=top>thisHREF: </td><td>[" + thisHREF + "]</td></tr>"
strwrite += "<tr><td valign=top>thisSLoc: </td><td>[" + thisSLoc + "]</td></tr>"
strwrite += "<tr><td valign=top>thisDLoc: </td><td>[" + thisDLoc + "]</td></tr>"
document.write( strwrite );
</script>
thisDLoc = document.location; <BR>
thisURL = document.URL; <BR>
thisHREF = document.location.href; <BR>
thisSLoc = self.location.href;<BR>
<script language="javascript">
thisTLoc = top.location.href;
thisPLoc = parent.document.location;
thisTHost = top.location.hostname;
thisHost = location.hostname;
strwrite = "<tr><td valign=top>thisTLoc: </td><td>[" + thisTLoc + "]</td></tr>"
strwrite += "<tr><td valign=top>thisPLoc: </td><td>[" + thisPLoc + "]</td></tr>"
strwrite += "<tr><td valign=top>thisTHost: </td><td>[" + thisTHost + "]</td></tr>"
strwrite += "<tr><td valign=top>thisHost: </td><td>[" + thisHost + "]</td></tr>"
document.write( strwrite );
</script>
thisTLoc = top.location.href; <BR>
thisPLoc = parent.document.location; <BR>
thisTHost = top.location.hostname; <BR>
thisHost = location.hostname;<BR>
<script language="javascript">
tmpHPage = thisHREF.split( "/" );
thisHPage = tmpHPage[ tmpHPage.length-1 ];
tmpUPage = thisURL.split( "/" );
thisUPage = tmpUPage[ tmpUPage.length-1 ];
strwrite = "<tr><td valign=top>thisHPage: </td><td>[" + thisHPage + "]</td></tr>"
strwrite += "<tr><td valign=top>thisUPage: </td><td>[" + thisUPage + "]</td></tr>"
document.write( strwrite );
</script><tr><td>
您可能感興趣的文章:
- JavaScript獲取當(dāng)前url根目錄(路徑)
- nodejs實(shí)現(xiàn)獲取當(dāng)前url地址及url各種參數(shù)值
- js和php如何獲取當(dāng)前url的內(nèi)容
- 解析js如何獲取當(dāng)前url中的參數(shù)值并復(fù)制給input
- js獲取url參數(shù)值的兩種方式
- JS URL傳中文參數(shù)引發(fā)的亂碼問(wèn)題
- javascript/jquery獲取地址欄url參數(shù)的方法
- url 編碼 js url傳參中文亂碼解決方案
- 在jsp頁(yè)面如何獲得url參數(shù)
- JS 中document.URL 和 windows.location.href 的區(qū)別
- JS實(shí)現(xiàn)獲取當(dāng)前URL和來(lái)源URL的方法
相關(guān)文章
uni-app跨端自定義指令實(shí)現(xiàn)按鈕權(quán)限操作
實(shí)現(xiàn)uni-app自定義指令按鈕權(quán)限需要涉及到對(duì)于vue.config.js新增loader配置,基礎(chǔ)正則知識(shí),webpack的loader開(kāi)發(fā)和調(diào)試,以及npm本地調(diào)試和發(fā)布,接下來(lái)就從了解這些前置知識(shí)開(kāi)始,需要的朋友可以參考下2023-01-01
selenium 反爬蟲(chóng)之跳過(guò)淘寶滑塊驗(yàn)證功能的實(shí)現(xiàn)代碼
這篇文章主要介紹了selenium 反爬蟲(chóng)之跳過(guò)淘寶滑塊驗(yàn)證功能,本文給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下2020-08-08
JS實(shí)現(xiàn)對(duì)JSON數(shù)據(jù)進(jìn)行冒泡排序
JavaScript 是一種廣泛使用的腳本語(yǔ)言,JSON是一種常見(jiàn)的數(shù)據(jù)格式,這篇文章主要來(lái)探討一下如何使用 JavaScript 對(duì) JSON 數(shù)據(jù)進(jìn)行冒泡排序,感興趣的可以了解一下2023-06-06
微信小程序開(kāi)發(fā)之實(shí)現(xiàn)記賬本
這篇文章主要為大家詳細(xì)介紹了如何通過(guò)微信小程序開(kāi)發(fā)一個(gè)簡(jiǎn)單的記賬本,文中的示例代碼講解詳細(xì),感興趣的小伙伴可以和小編一起學(xué)習(xí)一下2023-01-01
JavaScript實(shí)現(xiàn)復(fù)制文本到剪切板功能的方法小結(jié)
這篇文章給大家介紹了三種JavaScript實(shí)現(xiàn)復(fù)制文本到剪切板的方法,Clipboard API,document.execCommand以及useClipboard這三個(gè)接口,文章通過(guò)代碼示例給大家介紹的非常詳細(xì),需要的朋友可以參考下2023-11-11
JavaScript實(shí)現(xiàn)數(shù)組對(duì)象轉(zhuǎn)換為鍵值對(duì)的四種方式
本文探討了將包含 {icon: "abc", url: "123"} 形式對(duì)象的數(shù)組轉(zhuǎn)換為鍵值對(duì)形式的四種方法,并從實(shí)現(xiàn)方式的簡(jiǎn)潔性、可讀性和性能角度進(jìn)行了分析比較,感興趣的朋友可以參考下2024-02-02

