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>

在控制台直接打印出来

相关推荐
Paul_09201 小时前
golang面经——map模块和sync.Map模块
开发语言
Univin1 小时前
C++(10.5)
开发语言·c++·算法
haogexiaole1 小时前
Java高并发常见架构、处理方式、api调优
java·开发语言·架构
张人玉2 小时前
C# 通讯关键类的API
开发语言·c#
@大迁世界2 小时前
Vue 设计模式 实战指南
前端·javascript·vue.js·设计模式·ecmascript
froginwe112 小时前
R 数组:深入解析与高效使用
开发语言
tao3556672 小时前
【Python刷力扣hot100】283. Move Zeroes
开发语言·python·leetcode
progalchemist2 小时前
Quick SwiftObjective-C测试框架入门教程
开发语言·其他·objective-c·swift
芭拉拉小魔仙2 小时前
Vue项目中如何实现表格选中数据的 Excel 导出
前端·vue.js·excel