1.在HTML页面加载js文件的方法:
function loadScriptFile(filePath){
var script = document.createElement("script");
script.type = "text/javascript";
script.src = filePath;
document.head.appendChild(script);
}
2.在HTML页面加载css文件的方法:
function loadCsstFile(filePath){
var link = document.createElement("link");
link.type = "text/css";
link.rel = "stylesheet";
link.href = "filePath";
document.head.appendChild(link);
//document.getElementsByTagName("head")[0].appendChild(link);
}