function include(path){
var a=document.createElement("script"); a.type = "text/javascript"; a.src=path; var head=document.getElementsByTagName("head")[0]; head.appendChild(a); }可以在任何地方以
include("A.js");
include("../js/test.js");
等等来包含外部的js
include("A.js");
include("../js/test.js");
等等来包含外部的js