手机
当前位置:查字典教程网 >编程开发 >Javascript教程 >获取网站跟路径的javascript代码(站点及虚拟目录)
获取网站跟路径的javascript代码(站点及虚拟目录)
摘要:复制代码代码如下:functiongetRootPath(){varstrFullPath=window.document.location...

复制代码 代码如下:

<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代码(站点及虚拟目录)】相关文章:

javascript实现设置、获取和删除Cookie的方法

javascript判断并获取注册表中可信任站点的方法

网页制作常用Javascript语句

javascript基于DOM实现省市级联下拉框的方法

javascript验证邮件地址和MX记录的方法

解析javascript中鼠标滚轮事件

javascript制作的滑动图片菜单

javascript实现十秒钟后注册按钮可点击的方法

谈一谈javascript中继承的多种方式

实现DIV圆角的JavaScript代码

精品推荐
分类导航