日期:2014-05-16 浏览次数:20377 次
//js Map var JSHash = { index: [{url:"http://xxxx.js", version: "1.0"}], edit: [{url:"http://xxxx.js", version: "2.0"}] }
<script src=config.js></script> <script> loadJS("edit"); </script> //根据传入的key,动态生成js加载语句 function loadJS(sKey) { var node = JSHash[sKey]; for(var i =0;i < node.length; i ++) { document.writeln('<script src="'+node[i].url+'?version='+node[i].version+'"><\/script>'); } } //--> </script>