Template:Mainonly
This article relates to both the XML DOM and the HTML DOM; if your document contains HTML (or XHTML), see HTMLDocument.
The most commonly accessed Document instance is Window.document.
Methods
getElementsByTagName
| Data type | function |
|---|---|
| Return type | NodeList |
| Parameter list | tagName (string) |
| Standard | DOM Level 1, DOM Level 2 |
| Documentation | Mozilla, Microsoft |
Finds every element in the document which has the specified tagName. The asterisk ("*") matches all elements.
See also
getElementsByTagNameNS
| Data type | function |
|---|---|
| Return type | NodeList |
| Parameter list | tagName (string), namespace (string) |
| Standard | DOM Level 2 |
| Documentation | Mozilla |
Finds every element in the document which has the specified tagName and namespace. If the tagName is only the asterisk ("*"), all elements in the specified namespace will be returned.
getElementById
| Data type | function |
|---|---|
| Return type | Element |
| Parameter list | id (string) |
| Standard | DOM Level 1 HTML, DOM Level 2 |
| Documentation | Mozilla, Microsoft (IE8) |
Finds the first element in the document which has the specified id. In Internet Explorer 7 or less, returns the first element with the specified name if the id is not found.