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

源码网商城

javascript获取web应用根目录的方法

  • 时间:2020-08-31 06:33 编辑: 来源: 阅读:
  • 扫一扫,手机访问
摘要:javascript获取web应用根目录的方法
[u]复制代码[/u] 代码如下:
<script> function getRootPath(){ var strFullPath=window.document.location.href; var strPath=window.document.location.pathname; var pos=strFullPath.indexOf(strPath); var prePath=strFullPath.substring(0,pos); var postPath=strPath.substring(0,strPath.substr(1).indexOf(‘/')+1); return(prePath+postPath); } var webpath=getRootPath(); //webpath就是目录路径变量 </script>
  • 全部评论(0)
联系客服
客服电话:
400-000-3129
微信版

扫一扫进微信版
返回顶部