JQuery, let us control the page elements more convenient and fast, let us write JS when we do not need to think too much of the browser characteristics. But the more powerful the jquery function, the greater its own file. When doing site optimization, usually through the optimization of JS, CSS and picture files can squeeze out the hundreds of k size of the download.
Google is very interesting, it provides a jquery library, by using Google's jquery library, Google's server and line quality that is not a cinch. This increases the download speed and reduces the number of concurrent connections for your server.
It is also very simple to use, directly in the Web page to reference the relevant JS file on Google server can be. However, if you refer to more than one JS, you should insert multiple script pieces. Google also provides the appropriate solution, that is, Google load. We only need to quote a JS file in the page, we can load the JS library in real-time according to the need.
First, add the following line of code in the header section:
< script type= "Text/javascript" src= "Http://www.google.com/jsapi" ></script>
Loading jquery, you can use this:
Google.load ("jquery", "1.3.2");
In this way we will be from Google's recent CDN image loaded with the jquery 1.3.2 version of the JS library, then you can write the normal JS code. However, even Google's CDN image, download is after all, it takes time, in case the code base has not been downloaded and the browser has explained the following code how to do. We can set the JS library after loading to start the implementation of JS:
Google.setonloadcallback (function () {//code to be executed});
For more information about Google Jsapi's introduction and documentation, refer to: Google AJAX Library API
In addition to Jquery,google, it provides the following JS Framework/Library APIs:
JQuery UI
Prototype
Script.aculo.us
MooTools