现在的位置: 首页 > 综合 > 正文

javascript 实现 包含文件

2017年12月02日 ⁄ 综合 ⁄ 共 842字 ⁄ 字号 评论关闭

 

 

 function include_js(path)
{    
      var sobj = document.createElement('script');
      sobj.type = "text/javascript";
      sobj.src = path;
      var headobj = document.getElementsByTagName('head')[0];
      headobj.appendChild(sobj);
}
function include_css(path)
{    
var fileref=document.createElement("link")
fileref.rel = "stylesheet";
fileref.type = "text/css";
fileref.href = path;
var headobj = document.getElementsByTagName('head')[0];
headobj.appendChild(fileref);
}

抱歉!评论已关闭.