取到当前正在执行的script元素
by 司徒正美
at 2012-11-29 14:24:00
original http://www.cnblogs.com/rubylouvre/archive/2012/11/29/2794568.html
function getInteractiveScript(){
if(document.currentScript){
return document.currentScript;
}
var els = document.getElementsByTagName("script");
for(var i = 0, el; el = els[i++];){
if (el.readyState === 'interactive') {
return el
}
}
return null
}