📜  加载脚本上的 javascript - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:02:04.056000             🧑  作者: Mango

代码示例1
function loadScript( url, callback ) {
  var script = document.createElement( "script" )
        script.type = "text/javascript";
       script.onload = function() {
         callback()
      };
}
// call the function...
loadScript("js/myscript.js", function() {
  alert('script ready!'); 
});