xieronghua246 发表于 2013-2-7 23:12:32

JS实现动态引用文件

<script>
//******************************************************
// 包含文件 用法: $import('../include/mian.js', 'js');
//                 $import('../style/style.css', 'css');
//******************************************************
function $import(path, type)
{
  if (type == "css")
  {
      document.write("<" + "link href=\"" + path + "\" rel=\"stylesheet\" type=\"text/css\"></" + "link>");
  } else
  {
      document.write("<" + "script src=\"" +path + "\"></" + "script>");
  }
}
</script>
页: [1]
查看完整版本: JS实现动态引用文件