Here for you to provide three kinds of dynamic loading JS jquery instance code Oh, because jquery is to provide users with convenience, so the use of jquery dynamic loading files as long as a word $.getscript ("test.js"); OK.
Copy Code code as follows:
<!doctype HTML Public "-//W3C//DTD XHTML 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/ Xhtml1-transitional.dtd ""
<meta http-equiv= "Content-type" content= "text/html; charset=gb2312 "/>
<title>jquery dynamically load JS three methods </title>
//Method one
<script language=" Web Effects ">
$.getscript ("Test.js");
//Method two
function Loadjs (file) {
var head = $ (' head '). Remove (' #loadscript ');
& nbsp; $ ("<scri" + "pt>" + "</SCR" + "ipt>"). attr ({src:file,type: ' text/javascript ', ID: ' Load '}) . Appendto (head);
}
//Easy enough! If you can even use one line of code in the condensed below:
//Method three
$ ("<scri" + "pt>" + "</SCR" + "ipt>"). attr ({src:file,type: ' text/ JavaScript ', ID: ' Load '}. Appendto ($ (' head '). Remove (' #loadscript '));
</script>