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>

在控制台直接打印出来

相关推荐
学逆向的2 分钟前
C++多态 汇编分析
开发语言·汇编·c++·网络安全
都在酒里3 分钟前
STM32 Bootloader 实战:RS-485 固件升级与断电恢复
javascript·stm32·嵌入式硬件
阿凤2124 分钟前
学习java---流程控制篇
java·开发语言·学习
Code_Solitude1 小时前
c语言:期末最后一道大题模拟
c语言·开发语言
李松桃1 小时前
Python爬虫基础
开发语言·爬虫·python·get请求使用方法·post请求使用方法
weixin_307779131 小时前
Python用正则把 SQL 关键字整词匹配后转成小写
开发语言·python·sql·算法
JudithHuang1 小时前
Vue3 Vitest 单元测试进阶
前端·单元测试·log4j·vue
利威尔xu1 小时前
Go interface 底层:空接口装任何东西,类型断言漏写 ok 直接 panic 拖垮服务
开发语言·golang·interface·类型断言·itab
huaqianzkh1 小时前
WMI 查询入门到实战:从概念、WQL 语法到 C# 采集系统与硬件信息完整示例
开发语言·c#
费曼学习法1 小时前
把 Agent 可观测性做进 Harness:从日志里只有 task finished 到全链路回放
前端