Full-stack JavaScript path (14) class Attribute-related extensions in HTML5, html5class

Source: Internet
Author: User

Full-stack JavaScript path (14) class Attribute-related extensions in HTML5, html5class

1. getElementByClassName (): browsers that support the getElementsByClassName () method include IE 9 +, Firefox 3 +, Safari 3.1 +, Chrome and Opera 9.5 +.


2. classList attribute: The classList attribute is an instance of the new collection type DOMTokenList. the DOMTokenList type has a lenght attribute, indicating how many child elements are contained. To obtain each element, you can access it using the item () method or the [] method.

The new type also defines the following methods:

Add (value)

Remove (value)

Contains (value)

Toggle (value)


Browsers that support the classList attribute include Firefox 3.6 + and Chrome.





HTML5, CSS, and JAVASCRIPT-related popular science HTML 5 has two major features: First, it enhances the performance of Web pages. Second, added the functions of local databases and other Web applications. In a broad sense, HTML5 refers to a set of technical combinations including HTML, CSS, and JavaScript. It hopes to reduce the browser's need for rich plug-ins for network application services (plug-in-based rich internet application, RIA), such as Adobe Flash, Microsoft Silverlight, and Oracle JavaFX, it also provides more standard sets that can effectively enhance network applications.

Cascading Style Sheet (CSS) is also called Style Sheet. It is used for webpage Style design. For example, if you want to make the link word blue when it is not clicked, the word turns red and underlined after the mouse moves up, which is a style. You can set up a style sheet to control the display attributes of each sign in HTML. Cascading Style Sheets allow users to more effectively control the appearance of webpages. Using Cascading Style Sheets, you can expand the ability to precisely specify the location, appearance, and create special effects of webpage elements.

JavaScript is a client scripting language that is based on objects and events and is relatively secure. It is also a scripting language widely used in client Web development. It is often used to add dynamic functions to HTML Web pages, such as responding to various user operations. Originally designed by Brendan Eich of Netscape, Netscape is a dynamic, weak-type, prototype-based language with built-in support classes. JavaScript is a registered trademark of Sun. Ecma International has developed ECMAScript standards based on JavaScript. JavaScript can also be used in other scenarios, such as server-side programming. The complete JavaScript implementation consists of three parts: ECMAScript, Document Object Model, and byte sequence mark.
How to determine whether the browser supports certain html5 attributes, such as required and placeholder. Other common practices are to first determine the browser type and version number, and then determine whether the browser supports HTML5.

The easy-to-use method is to execute a special function in HTML5 and try to test whether the function is correctly executed. Because different browser versions have different levels of support for html5. in this case, most html5 methods or attributes are used only.

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.