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);
}

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-07-27
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-02-28
猜你喜欢
  • 2022-12-23
  • 2021-06-05
  • 2022-12-23
  • 2021-10-23
  • 2022-12-23
  • 2021-10-03
  • 2022-02-01
相关资源
相似解决方案