js获取网站根路径(站点及虚拟目录),获得网站的根目录或虚拟目录的根地址
2010-09-26 09:51
351 查看
//js获取网站根路径(站点及虚拟目录),获得网站的根目录或虚拟目录的根地址
function getRootPath(){
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);
}
*/
//js获取网站根路径(站点及虚拟目录),获得网站的根目录或虚拟目录的根地址
function getRootPath() {
var pathName = window.location.pathname.substring(1);
var webName = pathName == '' ? '' : pathName.substring(0, pathName.indexOf('/'));
//return window.location.protocol + '//' + window.location.host + '/'+ webName + '/';
return window.location.protocol + '//' + window.location.host + '/'+ webName;
}
function getRootPath(){
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);
}
*/
//js获取网站根路径(站点及虚拟目录),获得网站的根目录或虚拟目录的根地址
function getRootPath() {
var pathName = window.location.pathname.substring(1);
var webName = pathName == '' ? '' : pathName.substring(0, pathName.indexOf('/'));
//return window.location.protocol + '//' + window.location.host + '/'+ webName + '/';
return window.location.protocol + '//' + window.location.host + '/'+ webName;
}
相关文章推荐
- js获取网站根路径(站点及虚拟目录),获得网站的根目录或虚拟目录的根地址
- (转)js获取网站根路径(站点及虚拟目录)
- [转]js获取网站根路径(站点及虚拟目录)
- js获取网站根路径(站点及虚拟目录)
- [转]js获取网站根路径(站点及虚拟目录)
- [转]js获取网站根路径(站点及虚拟目录)
- 获取网站跟路径的javascript代码(站点及虚拟目录)
- js获取网站根目录(虚拟路径)方法
- 获取网站跟路径的javascript代码(站点及虚拟目录)
- asp.net 文件路径之获得虚拟目录的网站的根目录
- 获取网站根目录地址(绝对路径地址)
- asp.net 文件路径之获得虚拟目录的网站的根目录
- 获取网站虚拟目录下的物理路径
- js获取虚拟目录路径
- JS获取当前网址,JS获取当前域名URL ,JS获取网站完整路径页面地址
- JS获取当前网址,JS获取当前域名URL ,JS获取网站完整路径页面地址
- MVC 站点放在虚拟目录下 的 图片和JS文件路径设置
- C# 获取网站地址或网站虚拟目录
- asp.net下返回文件路径,获得虚拟目录的网站的根目录
- 网站获取非根目录下面的文件---虚拟路径