您的位置:首页 > Web前端 > JavaScript

js得到当前web应用的根目录

2008-09-28 17:18 260 查看
如:http://localhost:8080/news/template/index.jsp

得到的是:news

var basepath= document.location.pathname.substring(document.location.pathname.indexOf('/')+1) ;

basepath= basepath.substring(0,basepath.indexOf('/')) ;
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: