jquery动态加载
jQuery.getScript(url,[callback])
js动态加载
function loadJs(name) { document.write('<script src="'+name+'" type="text/javascript"></script>'); }
//另一种动态加载
function loadjscssfile(filename,filetype){ if(filetype == "js"){ var fileref = document.createElement('script'); fileref.setAttribute("type","text/javascript"); fileref.setAttribute("src",filename); }else if(filetype == "css"){ var fileref = document.createElement('link'); fileref.setAttribute("rel","stylesheet"); fileref.setAttribute("type","text/css"); fileref.setAttribute("href",filename); } if(typeof fileref != "undefined"){ document.getElementsByTagName("head")[0].appendChild(fileref); } } loadjscssfile("do.js","js");