Comparison of JavaScript libraries (i) DOM function _javascript techniques
Source: Internet
Author: User
1,prototype Program Library
This is the first library to simplify the document.getElementById () to $.
For example: the original Var myele=document.getelementbyid (' id ') is equivalent to the Var myele=$ (' id ')
In addition, $ also extends some of the features
For example: Var elearray=$ (' Id1 ', ' id2 ', ' id3 ', ' id4 ') can return an array containing 4 objects.
In addition to $, this library also provides a way to find elements based on the class name Getelementsbyclassname, the method to add the class name Addclassname, the method to remove the class name Removeclassname, etc., greatly facilitates our use.
2,jquery
It's more powerful than prototype.
Like what:
document.getElementById () ==>$ (' #money ')
document.getelementsbytagname==>$ (' P ')
Returns a set of elements with the same class name: $ ('. Money ')
And can be derived more like CSS: $ ("#content table.datetable")
The parsing feature of the CSS rules provided in the jquery library is amazing, and it supports CSS1,CSS2,CSS3 and most of the selectors in XPath.
3,dojo Program Library
Get element object based on ID: Var money=dojo.byid (' Money ')
Get elements based on class name: Dojo.html.getElementByClass ()
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service