Home > Web Front-end > JS Tutorial > Comparison of javascript libraries (1) DOM function_javascript skills

Comparison of javascript libraries (1) DOM function_javascript skills

WBOY
Release: 2016-05-16 18:30:16
Original
1214 people have browsed it
1, Prototype library

This is the first library that simplifies document.getElementById() to $.

For example: the original var myele=document.getElementById('id') is equivalent to var myele=$('id')

In addition, $ also extends some functions

For example: var eleArray=$('id1','id2','id3','id4') can return an array containing 4 objects.

In addition to $, this function library also provides the method getElementsByClassName to find elements according to class names; the method addClassName to add class names; the method removeClassName to remove class names, etc., which greatly facilitates our use.

2, jQuery

It is more powerful than prototype.

For example:
document.getElementById()==>$('#money')

document.getElementsByTagName==>$('p')

Returns a set of elements with the same class name: $('.money')

and can be derived like css: $("#content table.dateTable")

Provided in the jQuery library The css rule parsing capabilities are amazing, and it supports css1, css2, css3, and most selectors in XPath.

3, DoJo program library

Get the element object based on the id: var money=Dojo.byId('money')

Get it based on the class name Element:Dojo.html.getElementByClass()
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template