2009年7月7日星期二

[转]js包含js文件 Import javascript in javascript

if (typeof(jsfile) == 'undefined') var jsfile = new Object();

function includejs(jsFile) {
if (jsfile[jsFile] != null) return;
var scriptElt = document.createElement('script');
scriptElt.type = 'text/javascript';
scriptElt.src = jsFile;
document.getElementsByTagName('head')[0].appendChild(scriptElt);
jsfile[jsFile] = jsFile; // or whatever value your prefer
}

includejs('../myext/ext2/ext-base.js');
includejs('../myext/ext2/ext-all.js');
includejs('../myext/ext2/ext-lang-zh_CN.js');
includejs('../myext/ext2/PagingMemoryProxy.js');

没有评论: