Home >Web Front-end >JS Tutorial >JavaScript gets the code of an element on the page_javascript tips

JavaScript gets the code of an element on the page_javascript tips

WBOY
WBOYOriginal
2016-05-16 18:09:271113browse

The syntax recommended by W3C standards is to obtain an element in the DOM tree through the document document object. Common methods include getElementById(), getElementsByName(), and getElementsByTagName(). Their functions are through the id attribute and name attribute/tag name respectively. Returns a single node or collection of nodes.

Copy code The code is as follows:

.org/1999/xhtml">


JavaScript method of getting an element on the page