jsp在js里获取项目名

Posted 六元

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了jsp在js里获取项目名相关的知识,希望对你有一定的参考价值。

function getRootPath() {
var curWwwPath = window.document.location.href;
var pathName = window.document.location.pathname;
var pos = curWwwPath.indexOf(pathName);
var localhostPath = curWwwPath.substring(0, pos);
//获取带"/"的项目名,如:/hotel

var projectName = pathName.substring(0, pathName.substr(1).indexOf(‘/‘) + 1);
return projectName;

}

以上是关于jsp在js里获取项目名的主要内容,如果未能解决你的问题,请参考以下文章