Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document 的重要属性和方法 #33

Open
ClarenceC opened this issue Nov 23, 2017 · 0 comments
Open

Document 的重要属性和方法 #33

ClarenceC opened this issue Nov 23, 2017 · 0 comments

Comments

@ClarenceC
Copy link
Owner

HTMLDocument

可以通过Document实例访问页面.

Document 的属性

Document.childNodes 可以访问子节点
Document.childNodes[0] // <!DOCTYPE>
Document.childNodes[1] // <html></html>节点

Document.documentElement
Document.documentElement // <html></html>节点

Document.doctype
Document.doctype //<!DOCTYPE>
document.doctype.nodeType // 10 DOCUMENT_TYPE_NODE

Document.title
文档的题目

Document.URL
文档的连接

Document.domain
文档域名

Document 的方法

getElementById
按元素id获取

getElementsByTagName
按标签名获取元素

getElementsByName
获取特定的Name获取所有元素

write()
document.write 写脚本到页面

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant