我是靠谱客的博主 帅气大门,这篇文章主要介绍获取网站跟路径的javascript代码(站点及虚拟目录),现在分享给大家,希望可以做个参考。

复制代码 代码如下:

<script>
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>

最后

以上就是帅气大门最近收集整理的关于获取网站跟路径的javascript代码(站点及虚拟目录)的全部内容,更多相关获取网站跟路径内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(214)

评论列表共有 0 条评论

立即
投稿
返回
顶部