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>

在控制台直接打印出来

相关推荐
憧憬成为web高手2 小时前
ACTF 12307复现
前端·bootstrap·html
biter down3 小时前
14:pytest-order 插件 顺序控制案例
开发语言·python·pytest
wordbaby3 小时前
Axios 上传大文件崩溃:鸿蒙 RNOH 下 XHR 返回空响应头引发的"假失败"
前端·react native
郝学胜-神的一滴3 小时前
Qt 高级开发 009: C++ Lambda 表达式
开发语言·c++·qt·软件构建
wordbaby3 小时前
React Native 列表分页实战:下拉刷新与上拉加载的工程化方案
前端·react native
㳺三才人子3 小时前
初探 Flask
后端·python·flask·html
星栈独行3 小时前
我在 Rust 全栈项目里用 JWT 做无状态认证
开发语言·后端·rust·前端框架·开源·github·web
石山代码4 小时前
C++ 轻量级日志系统
开发语言·c++
wordbaby4 小时前
脱离 Tab 栏的艺术:React Native 全屏子页面的导航架构实践
前端·react native·harmonyos
陈随易4 小时前
Redis 8.8发布,一定要更新
前端·后端·程序员