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

源码网商城

获取网站跟路径的javascript代码(站点及虚拟目录)

  • 时间:2021-12-02 10:02 编辑: 来源: 阅读:
  • 扫一扫,手机访问
摘要:获取网站跟路径的javascript代码(站点及虚拟目录)
[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); } alert (getRootPath()); </script>
  • 全部评论(0)
联系客服
客服电话:
400-000-3129
微信版

扫一扫进微信版
返回顶部