有些时间我们希望能按需动态加载js文件,而不是直接在HTML中写script标签。 以下为示例代码: 1 var js = document.createElement('script'); 2 js.async = true; 3 js.src = jsSrc; 4 js.onload = function() { 5 // 加载完成了 6 } 来源:https://www.cnblogs.com/html5study-1/p/11892964.html 标签 动态