JavaScript: DOM Docunment

Meaning:

In browser , we exchange data using JavaScript code with user.

We should know that most of these interactions are done by the document object and its components.

Every HTML document loaded into the browser becomes a "Document object".So , "Document object" is very important.

Properties of the document object: 

expando
设置或获取表明是否可对象内创建任意变量的值。
activeElement
获取当父 document 拥有焦点时获得焦点的对象。
alinkColor
设置或获取元素中所有激活链接的颜色。
bgColor
不赞成。设置或获取表明对象后面的背景颜色的值。
charset
设置或获取用于解码对象的字符集。
cookie
设置或获取 cookie 的字符串值。
defaultCharset
从当前的区域语言中获取默认字符集。
designMode
设置或获取表明文档是否可被编辑的值。
dir
设置或获取表明对象的阅读顺序的值。
doctype
获取与当前文档关联的文档类型声明。
documentElement 
获取对文档根结点的引用。
domain 
设置或获取文档的安全域名。
 
 
fgColor
设置或获取文档的前景(文本)颜色。
fileCreatedDate
获取文件创建的日期。
fileModifiedDate
获取文件上次修改的日期。
fileSize
获取文件大小。
implementation
获取当前文档的 implementation 对象。
lastModified
获取页面上次修改的日期,若页面提供的话。
linkColor
设置或获取对象文档链接的颜色。
parentWindow
获取容器对象所在窗口的引用。
protocol
设置或获取 URL 的协议部分。
readyState
获取表明对象当前状态的值。
referrer
获取将用户引入当前页面的位置 URL。
uniqueID
获取为对象自动生成的唯一标识符。
URL
设置或获取当前文档的 URL。
URLUnencoded
获取文档的 URL,去除所有字符编码。
vlinkColor
设置或获取用户已访问过的链接颜色。
XMLDocument          
获取对由对象引出的的 XML 文档对象模型(DOM)的引用。
XSLDocument
获取对 XSL 文档的顶层结点的引用。

                           

aggregate of the document object:

集合
描述
all
返回对象所包含的元素集合的引用。
anchors
获取所有带有 name 和/或 id 属性的 a 对象的集合。此集合中的对象以 HTML 源顺序排列。
applets
获取文档中所有 applet 对象的集合。
childNodes  
获取作为指定对象直接后代的 HTML 元素和 TextNode 对象的集合。
embeds
获取文档中所有 embed 对象的集合。
forms
获取以源顺序排列的文档中所有 form 对象的集合。
frames
获取给定文档定义或与给定窗口关联的文档定义的所有 window 对象的集合。
images
获取以源顺序排列的文档中所有 img 对象的集合。
links
获取文档中所有指定了 HREF 属性的 a 对象和所有 area 对象的集合。
namespaces           
获取 namespace 对象的集合。
scripts
获取文档中所有 script 对象的集合。
styleSheets
获取代表与文档中每个 link 或 style 对象的实例相对应的样式表的 styleSheet 对象的集合。

                             

Object method:

document.write() 动态向页面写入内容
document.createElement(Tag) 创建一个html标签对象
document.getElementById(ID) 获得指定ID值的对象
document.getElementsByTagName(tagname) 获得指定标签名的对象
document.getElementsByName(Name) 获得指定Name值的对象
document.getElementsByClassName(classname) 获得指定类名的对象(html5 API)

                  (Reprinted from Baidu Encyclopedia)

Sharing some web sites with HTML Document learning and checking:

trigkit4-详解JavaScript Document对象:https://segmentfault.com/a/1190000000660947

W3school-HTML DOM Document 对象:http://www.w3school.com.cn/jsref/dom_obj_document.asp

Baidu-Document对象:https://baike.baidu.com/item/document%E5%AF%B9%E8%B1%A1/6553996

原文地址:https://www.cnblogs.com/chenzhihong294/p/9867803.html