web中jsp获取工程路径方法

来源:互联网 发布:广州大学网络教育平台 编辑:程序博客网 时间:2024/05/21 14:42
   /*
    *获取工程的路径
    */
 function getRootPath() {
  var pathName = window.location.pathname.substring(1);
  var webName = pathName == '' ? '' : pathName.substring(0, pathName
    .indexOf('/'));
  return window.location.protocol + '//' + window.location.host + '/'
    + webName + '/';
 }
  
0 0
原创粉丝点击