有些時間我們希望能按需動態加載js檔案,而不是直接在HTML中寫script標簽,
以下為示例代碼:
1 var js = document.createElement('script'); 2 js.async = true; 3 js.src =https://www.cnblogs.com/html5study-1/p/ jsSrc; 4 js.onload = function() { 5 // 加載完成了 6 }
轉載請註明出處,本文鏈接:https://www.uj5u.com/qiye/170389.html
標籤:JavaScript
