DIV CSS 佈局教程網

 DIV+CSS佈局教程網 >> 網頁腳本 >> JavaScript入門知識 >> JavaScript綜合知識 >> js獲取當前路徑的示例代碼
js獲取當前路徑的示例代碼
編輯:JavaScript綜合知識     

 本篇文章主要是對js獲取當前路徑的示例代碼進行了介紹,需要的朋友可以過來參考下,希望對大家有所幫助

<script type="text/javascript">     thisURL = document.URL;  thisHREF = document.location.href;  thisSLoc = self.location.href;  thisDLoc = document.location;  strwrite = " thisURL: [" + thisURL + "]<br />"  strwrite += " thisHREF: [" + thisHREF + "]<br />"  strwrite += " thisSLoc: [" + thisSLoc + "]<br />"  strwrite += " thisDLoc: [" + thisDLoc + "]<br />"  document.write( strwrite );   thisTLoc = top.location.href;  thisPLoc = parent.document.location;  thisTHost = top.location.hostname;  thisHost = location.hostname;  strwrite = " thisTLoc: [" + thisTLoc + "]<br />"  strwrite += " thisPLoc: [" + thisPLoc + "]<br />"  strwrite += " thisTHost: [" + thisTHost + "]<br />"  strwrite += " thisHost: [" + thisHost + "]<br />"  document.write( strwrite );    tmpHPage = thisHREF.split( "/" );  thisHPage = tmpHPage[ tmpHPage.length-1 ];  tmpUPage = thisURL.split( "/" );  thisUPage = tmpUPage[ tmpUPage.length-1 ];  strwrite = " thisHPage: [" + thisHPage + "]<br />"  strwrite += " thisUPage: [" + thisUPage + "]<br />"  document.write( strwrite );  var url="<%=request.getRequestURI()%>"; alert(url) </script>    request.getRequestURI(); request.getRequestURL(); request.getQueryString();   request.getServletPath()   可以得到自己的網絡地址:request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+request.getRequestURI()  
XML學習教程| jQuery入門知識| AJAX入門| Dreamweaver教程| Fireworks入門知識| SEO技巧| SEO優化集錦|
Copyright © DIV+CSS佈局教程網 All Rights Reserved