function loadJS(url) {//加载js

    loadScript = document.createElement("script");

    loadScript.type = "text/javascript";

    loadScript.src = url;

    document.body.appendChild(loadScript);

}

loadJS("xxx.js"); 

//loadScript.onload = function() {loadScript.onload = null;}


异步加载JS方法