js获取当前项目根目录

<html>
 <head>
     <script>
         location.pathname.replace(/\/[^/]+$/,''); //js获取当前项目跟目录
         alert(location.pathname);
         alert(location.pathname.replace(/\/[^/]+$/,''));
     </script>
 </head>
 <body>
 
 </body>
</html>

 

posted @ 2015-06-26 21:55  Conkis  阅读(166)  评论(0)    收藏  举报