标签:div get blocks ref window color bsp jsp json
1.获取项目路径的,不一定有用,仅作参考用:
1 function getRootPath() { 2 var curWwwPath = window.document.location.href; //"http://localhost:8080/springMVC/jsonTest.jsp" 3 var pathName = window.document.location.pathname; // /springMVC/jsonTest.jsp 4 var pos = curWwwPath.indexOf(pathName); // 21 5 var localhostPath = curWwwPath.substring(0, pos); //http://localhost:8080 6 var projectName = pathName.substring(0, pathName.substr(1).indexOf(‘/‘) + 1); // /springMVC 7 8 return (localhostPath + projectName); //http://localhost:8080/springMVC 9 }
标签:div get blocks ref window color bsp jsp json
原文地址:http://www.cnblogs.com/tenWood/p/6481070.html