Last active
August 29, 2015 14:18
-
-
Save codeBelt/e96b9f65b9953604338c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="application/javascript"> | |
function loadJS(file) { | |
// DOM: Create the script element | |
var jsElm = document.createElement("script"); | |
// set the type attribute | |
jsElm.type = "application/javascript"; | |
// make the script element load file | |
jsElm.src = file; | |
// finally insert the element to the body element in order to load the script | |
document.body.appendChild(jsElm); | |
} | |
</script> | |
<button onclick="loadJS('file1.js');">Load file1.js</button> | |
<button onclick="loadJS('file2.js');">Load file2.js</button> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment