js实现在HTML页面获取项目名路径

来源:互联网 发布:数据自动采集系统 编辑:程序博客网 时间:2024/05/17 23:24
<script type="text/javascript">  function sy(){  var curWwwPath = window.document.location.href;  var pathName =  window.document.location.pathname;  var pos = curWwwPath.indexOf(pathName);  var localhostPaht = curWwwPath.substring(0,pos);  var projectName = pathName.substring(0,pathName.substr(1).indexOf('/')+1);  return (localhostPaht + projectName);  }    </script>

1 0
原创粉丝点击