JavaScript library

JavaScript Framework (Library)

JavaScript Advanced programming (especially complex handling of browser differences) is often difficult and time-consuming.

In order to cope with these adjustments, many JavaScript (helper) libraries have emerged.

These JavaScript libraries are often called JavaScript frameworks.

In this tutorial, we will learn about some popular JavaScript frameworks:

jQuery

Prototype

MooTools

All of these frameworks provide functions for common JavaScript tasks, including animation, DOM manipulation, and Ajax handling.

In this tutorial, you'll learn how to start using them to make JavaScript programming easier, safer, and more fun.

jQuery

jQuery is currently the most popular JavaScript framework.

It uses CSS selectors to access and manipulate HTML elements (DOM objects) on web pages.

jQuery provides both companion UI (user interface) and plug-ins.

Many big companies use jQuery on their websites:

Google

Microsoft

IBM

Netflix

Prototype

Prototype is a library that provides a simple API for performing common web tasks.

API is the abbreviation of Application Programming Interface. It is a library of properties and methods for manipulating the HTML DOM.

Prototype enhances JavaScript by providing classes and inheritance.

MooTools

MooTools is also a framework that provides an API that makes common JavaScript programming easier.

MooTools also contains some lightweight effects and animation functions.

Other frameworks

Here are some other frameworks not covered above:

YUI - Yahoo! User Interface Framework, a large library covering a large number of functions, from simple JavaScript functions to complete internet widget.

Ext JS - Customizable widgets for building rich Internet applications.

Dojo - Toolkit for DOM manipulation, events, widgets, and more.

script.aculo.us - Open source JavaScript framework for visual effects and interface behavior.

UIZE - Widget, AJAX, DOM, templates and more.

CDN - Content Delivery Network

You always want your web pages to be as fast as possible. You want the size of the page to be as small as possible, and you want the browser to cache as much as possible.

If many different websites use the same JavaScript framework, it makes sense to put the framework library in a common location for each web page to share.

CDN (Content Delivery Network) solves this problem. A CDN is a network of servers containing a shareable code base.

Google provides a free CDN for a range of JavaScript libraries, including:

jQuery

Prototype

MooTools

Dojo

Yahoo! YUI

However, because Google is often blocked by GFW (Great Firewall of China, abbreviated as Great Firewall, abbreviated as GFW) in China, resulting in unstable access, it is recommended to use Baidu static resource public library: http://cdn.code.baidu.com/.

Using Frameworks

Before you decide to use a JavaScript framework for your web pages, it is wise to test the framework first.

JavaScript frameworks are easy to test. You don't need to install them on your computer, and there is no installer.

Usually you only need to reference a library file from the web page.


Continuing Learning
||
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>php中文网(php.cn)</title> <script src="http://libs.baidu.com/jquery/1.10.2/jquery.min.js"></script> <script> $(document).ready(function(){ $("#hide").click(function(){ $("p").hide(); }); $("#show").click(function(){ $("p").show(); }); }); </script> </head> <body> <p>这个是使用jQuery的一个实例</p> <button id="hide">隐藏</button> <button id="show">显示</button> </body> </html>
submitReset Code