Created
September 28, 2013 07:20
-
-
Save xyqfer/6739468 to your computer and use it in GitHub Desktop.
动态加载Javascript文件
This file contains 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
var script = document.createElement("script"); | |
if (script.readyState) { | |
script.onreadystatechange = function() { | |
if (script.readyState == "loaded" || script.readyState == "complete") { | |
script.onreadystatechange = null; | |
alert("ie"); | |
} | |
} | |
} else { | |
script.onload = function() { | |
alert("nice"); | |
} | |
} | |
script.src = "test.js"; | |
document.getElementsByTagName("head")[0].appendChild(script); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment