| 13 | | <button onclick="test();">run</button> |
| | 13 | <script type="text/javascript"> |
| | 14 | function test(){ |
| | 15 | var ele = document.getElementById('code'); |
| | 16 | new JSLoader({ |
| | 17 | append : ele, |
| | 18 | finish : function(){ |
| | 19 | status('end script'); |
| | 20 | } |
| | 21 | }) |
| | 22 | .next('http://svn.coderepos.org/share/lang/javascript/jsloader/trunk/test/script/load1.js') |
| | 23 | .next(function(){ |
| | 24 | status('loaded load1'); |
| | 25 | }) |
| | 26 | .next('http://svn.coderepos.org/share/lang/javascript/jsloader/trunk/test/script/load2.js', |
| | 27 | function(){ |
| | 28 | status('loading load2 and load3'); |
| | 29 | }, |
| | 30 | 'http://svn.coderepos.org/share/lang/javascript/jsloader/trunk/test/script/load3.js') |
| | 31 | .next(function(){ |
| | 32 | status('loaded load2 and load3'); |
| | 33 | }) |
| | 34 | .next('http://svn.coderepos.org/share/lang/javascript/jsloader/trunk/test/script/load4.js', |
| | 35 | 'http://svn.coderepos.org/share/lang/javascript/jsloader/trunk/test/script/load5.js', |
| | 36 | 'http://svn.coderepos.org/share/lang/javascript/jsloader/trunk/test/script/load6.js' ) |
| | 37 | .next(function(){ |
| | 38 | status('loaded load4 and load5 and load6'); |
| | 39 | }) |
| | 40 | .next('http://svn.coderepos.org/share/lang/javascript/jsloader/trunk/test/script/load7.js', |
| | 41 | 'http://svn.coderepos.org/share/lang/javascript/jsloader/trunk/test/script/load8.js') |
| | 42 | .next(function(){ |
| | 43 | status('loaded load7 and load8'); |
| | 44 | }) |
| | 45 | .next('http://svn.coderepos.org/share/lang/javascript/jsloader/trunk/test/script/load9.js', |
| | 46 | 'http://svn.coderepos.org/share/lang/javascript/jsloader/trunk/test/script/load10.js') |
| | 47 | .next(function(){ |
| | 48 | status('loaded load9 and load10'); |
| | 49 | }) |
| | 50 | .start(); |
| | 51 | } |
| | 52 | |
| | 53 | function status(mes){ |
| | 54 | var ele = document.getElementById('code'); |
| | 55 | ele.innerHTML = ele.innerHTML+'<p>'+mes+"<p>"; |
| | 56 | var loadStatus = ''; |
| | 57 | for(var i=1,l=10; i<=10; i++){ |
| | 58 | var val = 'load'+i; |
| | 59 | var status = ''; |
| | 60 | if(window[val]){ |
| | 61 | status = 'loaded'; |
| | 62 | }else{ |
| | 63 | status = 'undefined'; |
| | 64 | } |
| | 65 | loadStatus += '<li>'+val+':'+status+'</li>' |
| | 66 | } |
| | 67 | ele.innerHTML = ele.innerHTML+'<ul>'+loadStatus+'</ul>'; |
| | 68 | } |
| | 69 | </script> |