首頁 > web前端 > js教程 > js取得目前路徑的簡單範例程式碼_javascript技巧

js取得目前路徑的簡單範例程式碼_javascript技巧

WBOY
發布: 2016-05-16 17:04:56
原創
1109 人瀏覽過

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

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

tmpHPage = thisHREF.split( "/" );
thisHPage = tmpHPage[ tmpHPage.length-1 ]​​;
tmpUPage = thisURL.split( "/" );
thisUPage = tmpUPage[ tmpUPage.length-1 ]​​;
strwrite = " thisHPage: ["thisHPage "]
""
strwrite = " thisUPage: ["thisUPage "]
""
document.write( strwrite );
var url="";
警報(url)

request.getRequestURI();
request.getRequestURL();
request.getQueryString();

request.getServletPath()

可以取得自己的網路位址:request.getScheme() "://" request.getServerName() ":" request.getServerPort() request.getRequestURI()

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