js獲取當(dāng)前地址 JS獲取當(dāng)前URL的示例代碼
更新時間:2014年02月26日 10:10:38 作者:
本篇文章主要是對js獲取當(dāng)前地址 JS獲取當(dāng)前URL的示例代碼進行了介紹,需要的朋友可以過來參考下,希望對大家有所幫助
復(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實現(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ā)的亂碼問題
- javascript/jquery獲取地址欄url參數(shù)的方法
- url 編碼 js url傳參中文亂碼解決方案
- 在jsp頁面如何獲得url參數(shù)
- JS 中document.URL 和 windows.location.href 的區(qū)別
- JS實現(xiàn)獲取當(dāng)前URL和來源URL的方法
相關(guān)文章
uni-app跨端自定義指令實現(xiàn)按鈕權(quán)限操作
實現(xiàn)uni-app自定義指令按鈕權(quán)限需要涉及到對于vue.config.js新增loader配置,基礎(chǔ)正則知識,webpack的loader開發(fā)和調(diào)試,以及npm本地調(diào)試和發(fā)布,接下來就從了解這些前置知識開始,需要的朋友可以參考下2023-01-01
selenium 反爬蟲之跳過淘寶滑塊驗證功能的實現(xiàn)代碼
這篇文章主要介紹了selenium 反爬蟲之跳過淘寶滑塊驗證功能,本文給大家介紹的非常詳細,對大家的學(xué)習(xí)或工作具有一定的參考借鑒價值,需要的朋友可以參考下2020-08-08
JS實現(xiàn)對JSON數(shù)據(jù)進行冒泡排序
JavaScript 是一種廣泛使用的腳本語言,JSON是一種常見的數(shù)據(jù)格式,這篇文章主要來探討一下如何使用 JavaScript 對 JSON 數(shù)據(jù)進行冒泡排序,感興趣的可以了解一下2023-06-06
JavaScript實現(xiàn)復(fù)制文本到剪切板功能的方法小結(jié)
這篇文章給大家介紹了三種JavaScript實現(xiàn)復(fù)制文本到剪切板的方法,Clipboard API,document.execCommand以及useClipboard這三個接口,文章通過代碼示例給大家介紹的非常詳細,需要的朋友可以參考下2023-11-11
JavaScript實現(xiàn)數(shù)組對象轉(zhuǎn)換為鍵值對的四種方式
本文探討了將包含 {icon: "abc", url: "123"} 形式對象的數(shù)組轉(zhuǎn)換為鍵值對形式的四種方法,并從實現(xiàn)方式的簡潔性、可讀性和性能角度進行了分析比較,感興趣的朋友可以參考下2024-02-02

