动态加载js代码
程序员文章站
2022-08-05 20:24:27
动态加载js代码
function loadscirpt(src, fn, coding) {
var script = document.createelement('scrip...
动态加载js代码
function loadscirpt(src, fn, coding) { var script = document.createelement('script') script.async = false coding && script.charset = 'utf-8' script.type = 'type/javascript' script.readystate script.onreadystatechange = function() { ('loaded' == script.readystate || 'complete' == script.readystate) && (script.onreadystatechange = null, fn && fn()) : script.onload = function() { fn && fn() } script.src = src document.body.appendchild(script) } }