小白教程
所有教程
关于
Search
172.69.6.143
172.69.6.143
参数设置
贡献
退出
操作
编辑
移动
保护
信息
历史
删除
查看“Prop document documentelement”的源代码
本页内容
上一节:
Prop_document_doctype
下一节:
Prop_doc_documentmode
因为以下原因,您没有权限编辑本页:
您请求的操作仅限属于该用户组的用户执行:
用户
您可以查看和复制此页面的源代码。
{{DISPLAYTITLE:document.documentElement}}[[Category:dom obj document|15]] = HTML DOM documentElement 属性 = [[dom obj document|Document 对象]] 返回文档的 documentElement: <sample title="" desc="" lang="html" hererun="1"> document.documentElement; </sample> <run name=""> <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>小白教程(xiaobai.wang)</title> </head> <body> <p id="demo">单击按钮显示文档的节点名称</p> <button onclick="myFunction()">点我</button> <script> function myFunction(){ var x=document.getElementById("demo"); x.innerHTML=document.documentElement.nodeName; } </script> </body> </html> </run> == 定义和用法 == documentElement 属性以一个元素对象返回一个文档的文档元素。 HTML 文档返回对象为HTML元素。 '''注意:''' 如果 HTML 元素缺失,返回值为 null。 == 浏览器支持 == 所有主要浏览器都支持 documentElement 属性 == 语法 == <pre> document.documentElement</pre> == 技术细节 == {| class="table table-striped table-hover" | 返回值: | 文档的文档元素, 作为一个元素对象. |- | DOM 版本 | Core Level 1 Document 对象 |} [[dom obj document|Document 对象]]
返回至“
Prop document documentelement
”。
上一节:
Prop_document_doctype
下一节:
Prop_doc_documentmode