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

Two ways to get the body tag_Basic knowledge

WBOY
Release: 2016-05-16 18:00:58
Original
1760 people have browsed it

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)
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template