jquery怎么动态加载js文件

jquery如何动态加载js文件

jquery如何动态加载js文件:
本章节和大家分享一下几种动态加载js文件的方法,希望能够给需要的朋友带来帮助。
方法一:

 

$.getscript("test.js");

 

方法二:

function loadjs(file)
{ 
  var head = $('head').remove('#loadscript');
  $("<scri"+"pt>"+"</scr"+"ipt>").attr({src:file,type:'text/javascript',id:'load'}).appendto(head);
}

方法三:

$("<scri"+"pt>"+"</scr"+"ipt>").attr({src:file,type:'text/javascript',id:'load'}).appendto($('head').remove('#loadscript'));

原文地址是:http://www.softwhy.com/forum.php?mod=viewthread&tid=8556

更多内容可以参阅:http://www.softwhy.com/jquery/