首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > JavaScript >

在javascript中取得网站根路径的方法

2012-10-30 
在javascript中获得网站根路径的方法在javascript中获得网站根路径的方法function getRootPath() {var pat

在javascript中获得网站根路径的方法
在javascript中获得网站根路径的方法

        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;        }  

热点排行
Bad Request.