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>

在控制台直接打印出来

相关推荐
程序猿_极客3 小时前
【2025 年最新版】Java JDK 安装与环境配置教程(附图文超详细,Windows+macOS 通用)
java·开发语言·windows·macos·jdk
二哈喇子!6 小时前
BOM模型
开发语言·前端·javascript·bom
二哈喇子!6 小时前
Vue2 监听器 watcher
前端·javascript·vue.js
二哈喇子!6 小时前
空指针异常
开发语言
咚为6 小时前
Rust Print 终极指南:从底层原理到全场景实战
开发语言·后端·rust
%xiao Q6 小时前
GESP C++五级-202406
android·开发语言·c++
Psycho_MrZhang6 小时前
Neo4j Python SDK手册
开发语言·python·neo4j
yanyu-yaya6 小时前
前端面试题
前端·面试·前端框架
Traced back6 小时前
# C# + SQL Server 实现自动清理功能的完整方案:按数量与按日期双模式
开发语言·c#
sin22016 小时前
MyBatis的执行流程
java·开发语言·mybatis