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>

在控制台直接打印出来

相关推荐
IT_陈寒8 分钟前
React中useEffect依赖项这个坑我居然踩了三天
前端·人工智能·后端
qq43569470129 分钟前
Vue04
前端·vue.js
AC赳赳老秦1 小时前
OpenClaw+Power Apps 实战:自动生成 Power Apps 应用、连接 Excel 数据源
大数据·开发语言·python·serverless·excel·deepseek·openclaw
提笔了无痕1 小时前
如何用Go实现整套RAG流程
开发语言·后端·golang
(Charon)1 小时前
【C++ 面试高频基础:指针、引用、const、static、new/delete 总结】
java·开发语言
Yeats_Liao1 小时前
Feed流系统设计(三):数据模型与存储设计,从表结构到Redis收件箱
java·javascript·redis
我是真菜2 小时前
彻底理解js中的深浅拷贝
前端·javascript
2601_961875242 小时前
法考考试时间安排及科目|时间表|资料已整理
开发语言·c#·inverted-index·suffix-tree·sstable·r-tree·lsm-tree
江畔柳前堤2 小时前
github实战指南07-CLI 与高级技巧
前端·人工智能·chrome·深度学习·github·caffe·issue
AI科技星2 小时前
数术工坊第八卷:算力革命
c语言·开发语言·网络·量子计算·agi