1.获取工程名和获取参数JS代码
function GetRequest()
{
var url = location.search; // 获取url中"?"符后的字串
var theRequest = new Object();
if(url.indexOf("?") != -1)
{
var str = url.substr(1);
str = decodeURIComponent(str);
strs = str.split("&");
for(var i = 0; i < strs.length; i ++)
{
theRequest[strs[i].split("=")[0]]=unescape(strs[i].split("=")[1]);
}
}
return theRequest;
}
var Request = new Object();
Request = GetRequest();
if (Request.resultStr == undefined) {
return ;
} else if (Request.resultStr != '') {
var obj = eval("("+Request.resultStr+")");
if (obj.flag == 1) {
window.location.href = "manager/manager_managerCenter.action";
}else {
alert(obj.message);
}
}
});
</pre><pre name="code" class="javascript"><pre name="code" class="javascript">// 获取工程名
function getContextPath() {
var contextPath = document.location.pathname;
var index =contextPath.substr(1).indexOf("/");
contextPath = contextPath.substr(0,index+1);
delete index;
return contextPath;
}