<script type="text/javascript">
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+"/");
}
alert(getRootPath());
</script>
相关文章:
- php获取网站根目录 2022-12-23
- C# 获取网站站点根目录 2022-12-23
- js获取网站根路径(站点及虚拟目录),获得网站的根目录或虚拟目录的根地址 2021-11-12
- js获取网站根路径(站点及虚拟目录) 2021-12-08
- js获取网站项目根路径 2021-11-27