原文地址:http://blog.csdn.net/lihaiyun718/article/details/7249487
- /**
- * 获取项目根路径1
- * @return {RootPath}
- * @author 李海云
- */
- function getRootPath1(){
- 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)+"/";
- return(prePath+postPath);
- }
- /**
- * 获取项目根路径2
- * @return {RootPath}
- * @author 李海云
- */
- function getRootPath2()
- {
- var pathName = window.location.pathname.substring(1);
- var webName = pathName == '' ? '' : pathName.substring(0, pathName.indexOf('/'));
- return window.location.protocol + '//' + window.location.host + '/'+ webName + '/';
- }
最后
以上就是哭泣含羞草最近收集整理的关于js 获取 项目 根路径 JavaScript的全部内容,更多相关js内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复