派生到我的代码片 <script type="text/javascript"> //返回当前工作目录 function GetCurrDir(){ var pathName = window.location.pathname.substring(1); var DirName = pathName == '' ? '' : pathName.substring(0, pathName.lastIndexOf('/')); var reg=new RegExp("%20","g"); return DirName.replace(reg, " ");//替换空格 } </script>