Skip to content

Instantly share code, notes, and snippets.

@zmmbreeze
Created May 13, 2013 09:03
Show Gist options
  • Save zmmbreeze/5567068 to your computer and use it in GitHub Desktop.
Save zmmbreeze/5567068 to your computer and use it in GitHub Desktop.
返回当前正在执行脚本的<script>元素
// Reliably grab my script tag
function getScript() {
var script;
if (!(script = document.currentScript)) {
script = document.getElementsByTagName("script");
script = script[script.length - 1];
}
return script;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment