Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the common interfaces of HTML5

2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article introduces the relevant knowledge of "what are the HTML5 general interfaces?". In the operation of actual cases, many people will encounter such a dilemma. Then let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

1. Let's start with a few basic types: DOMString, boolean, long, unsigned long, double

NaN (Not-a-Number).

DOMString is actually the 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), double (floating point number) I don't think I need to elaborate, everyone can be clear. As for NaN, I think most old JS birds also know its meaning, that is, in an infinity.

Or a non-numeric value.

Undefined and null are not introduced in the official documents. As for why, I hope there are experts to give answers.

two。 Collection types include: HTMLCollection, HTMLAllCollection

HTMLFormControlsCollection, HTMLOptionsCollection, and

HTMLPropertiesCollection .

HTMLCollection is a generic collection and the basic interface for a collection, which provides three attributes:

Length, item, namedItem.

Length is the length of the collection.

Item (index) can get the elements in the collection with index values.

NamedItem (name) can get an element using its name.

In fact, you can also use index, collection (index) or collection directly.

[name], collection (name) gets the elements in the collection.

HTMLAllCollection inherits from the HTMLCollection interface and contains the following properties:

The length and item properties are the same as those of HTMLCollection.

NamedItem (name) differs from HTMLCollection in that it is likely to return a collection.

Tags (tagname) returns a collection with tagname.

You can also directly use alternative [index], collection (index) or collection

[name], collection (name) gets the elements in the collection and returns a

HTMLAllCollection .

HTMLFormControlsCollection is a collection of form and fieldset elements. Also inherited from

HTMLCollection interface.

It has all the properties of HTMLCollection and adds an additional RadioNodeList interface. It inherits from NodeList.

In fact, RadioNodeList is by definition a collection of Radiobutton. I am curious about such a list.

The meaning in HTMLFormControlsCollection.

HTMLOptionsCollection is a collection of option that inherits from the HTMLCollection interface. It generally uses the

Manipulate the child elements of the select tag.

The unique properties of HTMLOptionsCollection are: add (option), remove (index), selectedIndex

The add method has two overloads

Void add (in HTMLElement element, in optional HTMLElement before)

Void add (in HTMLElement element, in long before)

The first parameter of an element must be added, and the following parameters are optional

Remove (index) deletes an element by index.

SelectedIndex, I'm sure everyone will understand.

This is the end of the content of "what are the general interfaces for HTML5". Thank you for your reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report