function getRealPath(){ var curWwwPath = window.document.location.href; var pathName = window.document.location.pathname; var localhostPath=curWwwPath.substring(0, curWwwPath.indexOf(pathName)); var projectName = pathName.substring(0,pathName.substr(1).indexOf('/')+1); return localhostPath + projectName; }
用于html页面路径