Introduction to common HTML5 interfaces and general html5 Interfaces

Source: Internet
Author: User

Introduction to common HTML5 interfaces and general html5 Interfaces
1. Let's talk about several basic types: DOMString, boolean, long, unsigned long, double, NaN (Not-a-Number ). DOMString is actually a string in other commonly used languages. In HTML5, it is used to represent url, Dom content, and so on. Other boolean (boolean), long (long integer), unsigned long (unsigned long integer), and double (floating point number) I don't want to go into detail, so everyone can understand. As for NaN, I think most of the old JS birds know its meaning, that is, they are in an infinite or non-numeric value.
Undefined and null are not described in the official documents. As for why, I hope you can answer them with experts ~~ 2. Collection types include HTMLCollection, HTMLAllCollection, HTMLFormControlsCollection, HTMLOptionsCollection, and andHTMLPropertiesCollection. HTMLCollection is a generic set and is also a basic interface of the set. It provides three attributes: length, item, namedItem.
Length is the length of the set.
Item (index) can be used to obtain the elements in the set with the index value.
NamedItem (name) can be used to obtain the element with the name of the element.
In fact, you can also directly use collection [index], collection (index), collection [name], collection (name) to obtain the elements in the collection. HTMLAllCollection is inherited from the HTMLCollection interface and contains the following attributes:
The attributes of length and item are the same as those of HTMLCollection.
What distinguishes namedItem (name) from HTMLCollection is that it may return a set.
Tags (tagname) returns a set with tagname.
You can also directly use collection [index], collection (index) or collection [name], collection (name) to obtain the elements in the collection, if the value matches multiple elements, an HTMLAllCollection is returned. HTMLFormControlsCollection is a collection of form and fieldset elements. It also inherits from the HTMLCollection interface.
All attributes of HTMLCollection are available, and the RadioNodeList interface is added. It inherits from NodeList.
In fact, RadioNodeList is a set of Radiobutton by definition. I'm curious about the intention of placing such a list in HTMLFormControlsCollection. HTMLOptionsCollection is an option set inherited from the HTMLCollection interface. It is generally used to manipulate the sub-elements of the select tag.
HTMLOptionsCollection has the following attributes: add (option), remove (index), selectedIndex
The add method has two reloads.
Void add (in HTMLElement element, in optional HTMLElement before );
Void add (in HTMLElement element, in long before); the first parameter required for adding an element is optional.
Remove (index) deletes an element with an index.
SelectedIndex can be understood.

Related Article

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.