源码网商城,靠谱的源码在线交易网站 我的订单 购物车 帮助

源码网商城

js获取当前路径的简单示例代码

  • 时间:2020-07-22 11:17 编辑: 来源: 阅读:
  • 扫一扫,手机访问
摘要: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()
  • 全部评论(0)
联系客服
客服电话:
400-000-3129
微信版

扫一扫进微信版
返回顶部