jsp在js里获取项目名
时间:2020-04-14 12:23:17
收藏:0
阅读:55
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;
}
原文:https://www.cnblogs.com/liuyuanchen/p/12696940.html
评论(0)