jquery获取项目的路径

var getWebRootPath = function () {
var a = window.document.location.href;//
var b = window.document.location.pathname;
var pos = a.indexOf(b);
var path = a.substring(0, pos);
a = a.substring(a.indexOf("/") + 2, a.length);
a = a.substring(a.indexOf("/") + 1, a.length);
var pathName = a.substring(0, a.indexOf("/"));
return path + "/" + pathName;
}
posted @ 2016-06-29 11:26  汪星人  阅读(3008)  评论(0编辑  收藏  举报