Get elements by ID--getElementByIdStandard
DOM 1, defined in Interface, is a HTMLDocument prototype Element getElementById(in DOMString elementId) that returns NULL when no element with the corresponding ID exists, and the method does not
In the Web standard, you can use getelementbyid (), getelementsbyname (), and getelementsbytagname () to access any tag in the document.
(1) getelementbyid ():
Getelementbyid () can access a specific element in the document. As the name suggests,
In the Web standard, you can use getelementbyid (), getelementsbyname (), and getelementsbytagname () to access any tag in the document.
(1) getelementbyid ():
Getelementbyid () can access a specific element in the document. As the name suggests,
The getElementById () method of the html DOM document Object, domgetelementbyid
The getElementById () method returns a reference to the first object with the specified ID.
Syntax:
document.getElementById(id)
The html dom defines multiple methods for
Definition and usageThe getElementById () method returns a reference to the first object that owns the specified ID.Grammardocument.getElementById (ID)DescriptionThe HTML DOM defines a variety of methods for finding elements, with the exception of
Definition and usageThe getElementById () method returns a reference to the first object that owns the specified ID.Grammardocument.getElementById (ID)DescriptionThe HTML DOM defines a variety of methods for finding elements, with the exception of
getElementById () and getElementsByTagName () one is the ID and the other is name what is the difference between them, getElementById () only for HTML operations and not the XML file processing, But getElementsByTagName is OK. Let's take a look at
The previous article in this series examined the concepts involved in the Document Object Model (DOM) programming-How web browsers regard web pages as a tree. Now you should understand the programming structure used in Dom. In this tutorial, we will
First declare DOM2 in Nodeiterator and treewalker these two types really just used to play, because performance does not traverse super slow, in JS basically do not use them, in addition to "elevation" there are two or three pages to explain it,
Web standards can access any of the tags in the document through getElementById (), Getelementsbyname (), and getElementsByTagName ().(1) getElementById ():getElementById () can access a specific element in the document, as the name implies, by
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.