Home  >  Article  >  Web Front-end  >  Two ways to get the body tag_Basic knowledge

Two ways to get the body tag_Basic knowledge

WBOY
WBOYOriginal
2016-05-16 18:00:581724browse

There are two ways to reference the body tag:

The first one: Use DOM Core to reference the first (and only) body tag of a given document

Copy code The code is as follows:

document.getElementsByTagName("body")[0]

Second Type: Use HTML-DOM, that is, refer to the body attribute of a given document:
Copy code The code is as follows:

doucumnet.body

The focus of this article:

1. Which is DOM Core and which is HTML-DOM (slowly added)
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn