var version = "1.0"
|
|
function LoadCSS(url, isappendversion) {
|
if (isappendversion) {
|
url += "?version=" + version;
|
}
|
document.write('<link rel="stylesheet" href= ' + url + ' media="all"></link>');
|
}
|
|
function LoadJS(url, isappendversion) {
|
if (isappendversion) {
|
url += "?version=" + version;
|
}
|
document.write('<script src= ' + url + '></script>');
|
}
|
|
function GetRootPath() {
|
var loc = window.location,
|
host = loc.hostname,
|
protocol = loc.protocol,
|
port = loc.port ? (':' + loc.port) : '';
|
var path = location.pathname;
|
|
if (path.indexOf('/') === 0) {
|
path = path.substring(1);
|
}
|
|
var mypath = '/' + path.split('/')[0];
|
path = (mypath != undefined ? mypath : ('/' + loc.pathname.split('/')[1])) + '/';
|
|
var rootPath = protocol + '//' + host + port + path+"/";
|
return rootPath;
|
}
|
|
function GetCookie(cookieName) {
|
//获取所有的cookie "psw=1234we; rememberme=true; user=Annie"
|
var totalCookie = document.cookie;
|
//获取参数所在的位置
|
var cookieStartAt = totalCookie.indexOf(cookieName + "=");
|
//判断参数是否存在 不存在直接返回
|
if (cookieStartAt == -1) {
|
return;
|
}
|
//获取参数值的开始位置
|
var valueStartAt = totalCookie.indexOf("=", cookieStartAt) + 1;
|
//以;来获取参数值的结束位置
|
var valueEndAt = totalCookie.indexOf(";", cookieStartAt);
|
//如果没有;则是最后一位
|
if (valueEndAt == -1) {
|
valueEndAt = totalCookie.length;
|
}
|
//截取参数值的字符串
|
var cookieValue = unescape(totalCookie.substring(valueStartAt, valueEndAt));
|
return cookieValue;
|
}
|
|
LoadJS(GetRootPath() + 'plugin/jquery/jquery-1.10.2.min.js', false);
|
LoadJS(GetRootPath() + 'plugin/jquery/jquery.validate.min.js', false);
|
LoadJS(GetRootPath() + 'plugin/jquery/jquery.validate.message_cn.js', false);
|
LoadJS(GetRootPath() + 'js/common.js', false);
|
LoadJS(GetRootPath() + 'plugin/layui/layui.js', false);
|
LoadJS(GetRootPath() + 'plugin/layuiextend/table.js', true);
|
LoadJS(GetRootPath() + 'plugin/layuiextend/dialog.js', true);
|
LoadJS(GetRootPath() + 'plugin/layuiextend/form.js', true);
|
LoadJS(GetRootPath() + 'plugin/layuiextend/select.js', true);
|
LoadCSS(GetRootPath() + 'css/common.css', true);
|
LoadCSS(GetRootPath() + 'plugin/layui/css/layui.css', false);
|