Skip to content

Instantly share code, notes, and snippets.

@anytizer
Created March 3, 2014 14:21
Show Gist options
  • Save anytizer/9325866 to your computer and use it in GitHub Desktop.
Save anytizer/9325866 to your computer and use it in GitHub Desktop.
attach js
<script type="text/javascript">
/**
* Add a script element as a child of the body
*/
function attachJS()
{
var element = document.createElement("script");
element.src = "js/attached.js"
document.body.appendChild(element);
}
// Browser capability
if(window.addEventListener)
window.addEventListener("load", attachJS, false);
else if(window.attachEvent)
window.attachEvent("onload", attachJS);
else window.onload = attachJS;
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment