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>

在控制台直接打印出来

相关推荐
粉末的沉淀8 分钟前
css:制作带边框的气泡框
前端·javascript·css
p***h6431 小时前
JavaScript在Node.js中的异步编程
开发语言·javascript·node.js
散峰而望1 小时前
C++数组(二)(算法竞赛)
开发语言·c++·算法·github
Porunarufu1 小时前
Java·关于List
java·开发语言
N***73852 小时前
Vue网络编程详解
前端·javascript·vue.js
e***71672 小时前
Spring Boot项目接收前端参数的11种方式
前端·spring boot·后端
程序猿小蒜2 小时前
基于springboot的的学生干部管理系统开发与设计
java·前端·spring boot·后端·spring
银空飞羽2 小时前
让Trae CN SOLO自主发挥,看看能做出一个什么样的项目
前端·人工智能·trae
子不语1802 小时前
Python——函数
开发语言·python
ndjnddjxn2 小时前
Rust学习
开发语言·学习·rust