Home  >  Article  >  Web Front-end  >  获取body标签的两种方法_基础知识

获取body标签的两种方法_基础知识

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

引用body标签有两做法:

第一种:使用DOM Core 即引用某个给定文档的第一个(也是仅有的一个)body标签

复制代码 代码如下:

document.getElementsByTagName("body")[0]

第二种:使用HTML-DOM,即引用某个给定文档的body属性:
复制代码 代码如下:

doucumnet.body

本文的重点:

1. 哪些是DOM Core,哪些是HTML-DOM(慢慢补充)
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