js获取web应用的根目录上下文

来源:互联网 发布:java executor 线程池 编辑:程序博客网 时间:2024/06/05 21:01



function getWebRootPath() {    var webroot=document.location.href;    webroot=webroot.substring(webroot.indexOf('//')+2,webroot.length);    webroot=webroot.substring(webroot.indexOf('/')+1,webroot.length);    webroot=webroot.substring(0,webroot.indexOf('/'));    var rootpath="/"+webroot;    return rootpath;}


0 0
原创粉丝点击