jsp和html抽取出js来引入通用的js和css资源

举例说明:

// 通用js和css
(function (){
	var strFullPath=window.document.location.href;
	var strPath=window.document.location.pathname;
	
	
	var pos=strFullPath.indexOf(strPath);
	var prePath=strFullPath.substring(0,pos);
	var postPath=strPath.substring(0,strPath.substr(1).indexOf('/')+1);
	var appRootPath = prePath+postPath;
	alert("strFullPath:"+strFullPath+"strPath:"+"&&"+strPath+"&&"+"pos:"+pos+"prePath:"+prePath);
	var jsHeader = "";
	document.write(jsHeader + "common/js/jquery-1.12.3.js" + jsFooter);
	document.write(jsHeader + "common/js/common.js" + jsFooter);
	document.write(jsHeader + "layui/src/layui.js" + jsFooter);
	document.write(jsHeader + "layui/src/layui-xtree.js" + jsFooter);
	document.write(jsHeader + "common/js/user_input_validation_util.js" + jsFooter);
	
	var cssHeader = "";
	document.write(cssHeader + "layui/src/css/layui_1366.css" + cssFooter);
})();

你可能感兴趣的:(jsp,前端)