首頁  >  文章  >  web前端  >  js取得目前位址 JS取得目前URL的範例程式碼_javascript技巧

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

WBOY
WBOY原創
2016-05-16 16:58:151044瀏覽
複製程式碼如下程式碼:



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"]

陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn