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>

在控制台直接打印出来

相关推荐
云浪7 分钟前
前端二进制数组完全指南:ArrayBuffer、TypedArray、DataView 一次讲透
前端·javascript
张风捷特烈9 分钟前
Flutter 类库大揭秘#02 | path_provider 各平台实现
前端·flutter
铁皮饭盒1 小时前
26年bunjs, elysia+pg一把梭, redis都省了
前端·javascript·后端
lichenyang45314 小时前
Docker 学习笔记(一):为什么需要镜像、容器和仓库?
前端
kyriewen14 小时前
别再对着 TypeScript 报错发呆了:我把 10 个最常见的红色波浪线翻译成了人话
前端·javascript·typescript
IT_陈寒14 小时前
SpringBoot自动配置的坑,我的API突然就404了
前端·人工智能·后端
free3515 小时前
从 0 实现一个 Tiny JavaScript VM:项目架构拆解
javascript
奇奇怪怪的15 小时前
Embedding 模型 10+ 横向评测
前端
陈广亮15 小时前
Monorepo 从 0 到 1 实操指南 2026 版:pnpm catalogs + Turborepo 2.x + changesets 全链路
前端