Created
October 14, 2013 15:15
-
-
Save libo1106/6977263 to your computer and use it in GitHub Desktop.
loadScript 给页面添加外部script
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
function loadScript (doc, type, src, callback) { | |
var script = doc.createElement('script'); | |
script.type = type ? type : 'application/javascript'; | |
script.onload = callback; | |
script.src = src; | |
doc.head.appendChild(script); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment