首頁 > web前端 > js教程 > 主體

js取得目前位址 JS取得目前URL的範例程式碼_javascript技巧

WBOY
發布: 2016-05-16 16:58:15
原創
1042 人瀏覽過
複製程式碼如下程式碼:



thisURL = document.URL;
thisHREF = document.location.href;
thisSLoc = self.location.href;
thisDLoc = document.location;
strwrite = ""
strwrite = ""
strwrite = ""
strwrite = ""
document.write( strwrite );

thisDLo = document.location;

thisURL = document.URL;

thisHREF = document.location.href;

thisSLoc = self.location.href;


thisTLoc = top.location.href;
thisPLoc =parent.document.location;
thisTHost = top.location.主機名稱;
thisHost = 位置.主機名稱;
strwrite = ""
strwrite = ""
strwrite = ""
strwrite = ""
document.write( strwrite );

thisTLoc = top.location.href;

thisPLoc =parent.document.location;

thisTHost = top.location.主機名稱;

thisHost = location.主機名稱;


tmpHPage = thisHREF.split ( “/”);
thisHPage = tmpHPage[ tmpHPage.length-1 ]​​;
tmpUPage = thisURL.split( "/" );
thisUPage = tmpUPage[ tmpUPage.length-1 ]​​;
strwrite = ""
strwrite = ""
document.write( strwrite );
thisURL: ["thisURL "]
thisHREF: ["thisHREF "]
thisSLoc: [" thisSLoc "]
thisDloc: ["thisDloc"]
thisTLoc: [" thisTLoc "]
thisPLoc: [" thisPLoc "]
thisTHost: ["thisTHost "]
thisHost: ["thisHost "]
thisHPage: ["thisHPage "]
thisUPage: ["thisUPage"]

相關標籤:
來源:php.cn
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
最新問題
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板