getElementById
method
getElementsByTagName
method
getElementById
Method
getElementById
method returns the element with the specified ID.
The script shows how to locate a <p> element in the document by using the getElementById method.
The method getAttribute of the interface Element , which represents an element in an HTML or XML document, is used to get the value of an attribute in an object.
|
|
getElementsByTagName
Method
getElementsByTagName returns all elements with a specified tag name.
The method returns a NodeList , which represents an ordered collection of nodes.
The length property returns the number of items in a NodeList .
|
|