首页 > 代码库 > js文件先后顺序加载的问题

js文件先后顺序加载的问题

<script type="text/javascript">        function loadScript(url, callback) {           var _script = document.createElement("script");               _script.type="text/javascript";                           if (_script.readyState) {//IE                _script.onreadystatechange = function () {                   if (_script.readyState == "loaded" || _script.readyState == "complete") {                       _script.onreadystatechange = null;                       callback();                     }                };             }else{                 _script.onload = function () {//非IE                     callback();                 };             }                _script.src=url;                document.getElementsByTagName("head")[0].appendChild(_script);         };                loadScript("js/jquery-1.10.1.min.js", function () {                              loadScript("js/idangerous.swiper.js", function () {                                  loadScript("js/BaccChartParse.js", function () {                                          loadScript("js/textjs.js", function () {                                              });                 });             });         });   </script>        

 

js文件先后顺序加载的问题