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

js 获取当前web应用的前后文路径

2014-01-03 
js 获取当前web应用的上下文路径function getWebRootPath() {??? var webrootdocument.location.href???

js 获取当前web应用的上下文路径

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

热点排行