js中获取basePath

单独js文件中el不能获取,通过以下方式获取
1
var location = (window.location+'').split('/'); 2 var basePath = location[0]+'//'+location[2]+'/'+location[3]; 3 var url = basePath + '/js/xxx.js';

 

posted @ 2015-09-30 12:02  flay  阅读(1471)  评论(0编辑  收藏  举报