HTML DOM 教程---获取非常规元素(html,body,head)

html 复制代码
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>获取非常规元素</title>
</head>
<body>
    <ul>
        <li>111111111</li>
        <li>111111111</li>
        <li>111111111</li>
        <li>111111111</li>
    </ul>
    <script>
        // 获取html
        console.log(document.documentElement)
        // 获取head
        console.log(document.head)
        // 获取body
        console.log(document.body)
    </script>
</body>
</html>

在控制台直接打印出来

相关推荐
ZPC82101 小时前
如何创建一个单例类 (Singleton)
开发语言·前端·人工智能
超绝振刀怪1 小时前
【C++多态】
开发语言·c++
入瘾1 小时前
etcd 显示连接失败
数据库·chrome·etcd
紫_龙1 小时前
最新版vue3+TypeScript开发入门到实战教程之重要详解readonly/shallowReadOnly
前端·javascript·typescript
workflower1 小时前
AI制造-推荐初始步骤
java·开发语言·人工智能·软件工程·制造·需求分析·软件需求
魔都吴所谓2 小时前
【Python】从零构建:IP地理位置查询实战指南
开发语言·python·tcp/ip
环黄金线HHJX.2 小时前
【吧里BaLi社区】
开发语言·人工智能·qt·编辑器
oioihoii2 小时前
Cursor根本无法调试C++
开发语言·c++
GISer_Jing3 小时前
Agent多代理架构:子代理核心机制解密
开发语言·人工智能·架构·aigc