不过如果你是要得到相对路径的话可以这样得到var srp=document.getElementsByTagName('script');
alert(srp[srp.length-1].src);