Google jquery CDN Acceleration Point
Http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js
Microsoft jquery CDN Acceleration Point
Http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.7.2.min.js
Sina jquery CDN Acceleration Point
Http://lib.sinaapp.com/js/jquery/1.7.2/jquery.min.js
You can also write this, the first choice, if the load failed JS will load the second address
The code is as follows |
Copy Code |
<script type= "Text/javascript" src= "Http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" ></ Script> <script type= "Text/javascript" > !window.jquery && document.write (' <script src=http://lib.sinaapp.com/js/jquery/1.7.2/jquery.min.js> </script> '); </script> |
Cloud Habitat Community Small series to provide you with a late loading of JS file method
The code is as follows |
Copy Code |
settimeout (function () { var scr=document.createelement (' script '); scr.src= ' Language.js '; Scr.type= ' Text/javascript '; Document.appendchild (SCR); },1000) |
Cases
code is as follows |
copy code |
Function _ Getjsdata (URL, callback) { var scripts = document.createelement (' script '); & nbsp; document.body.appendChild (scripts); scripts.onload = function () { isOK (); //Document.body.removeChild (this); }; Scripts.onreadystatechange = function () { if (this.readystate = = "Loaded") { isOK (); // Document.body.removeChild (this); } }; scripts.charset = "GBK"; scripts.src = url; } _getjsdata ('/js/util/yahoo.js ', ' isOK '); var isok=function () {alert (' isOK ')}; |