Dashcode加载part.js
中数组中列出的一堆库(function() {
var scripts = dashcodePartSupport['core'];
scripts = scripts.concat(dashcodePartSupport['scripts']);
for(var index in scripts) {
var path = scripts[index];
var scriptTag = '<script apple-no-regeneration="yes" type="text/javascript" src="' + path + '"></script>';
document.write( scriptTag );
}
})();
我尝试编辑该文件以附加我自己的lib,但该文件不可编辑。那我该怎么办?
答案 0 :(得分:1)
function loadCode(code) {
var i, j = code.length, element;
for(i=0;i<j;++i) {
element = document.createElement('script');
element.src = code[i];
document.getElementsByTagName('head')[0].appendChild(element);
}
}
您可以这样使用此功能:
loadCode(['code1.js', 'code2.js', ...]);