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>

在控制台直接打印出来

相关推荐
Jinkxs几秒前
SkyWalking - Python 应用追踪:基于 skywalking-python 的埋点
开发语言·python·skywalking
大头博士先生几秒前
【3月考】二级Python最新真题及满分代码合集(基本操作题部分)
开发语言·python
wuhen_n1 分钟前
案例分析:从“慢”到“快”,一个后台管理页面的优化全记录
前端·javascript·vue.js
xcLeigh2 分钟前
IoTDB Python原生接口全攻略:从基础读写到高级实战
开发语言·数据库·python·api·iotdb·原生接口·读写数据
User_芊芊君子3 分钟前
文科生封神!Python+AI 零门槛变现:3 天造 App,指令即收入(附脉脉 AI 沙龙干货)
开发语言·人工智能·python
是Dream呀3 分钟前
2025年中秋月亮只有94.91%圆?Python告诉你真相
开发语言·python·中秋节
星辰徐哥4 分钟前
Python开发从入门到精通:异步编程与协程
开发语言·python
AI智能研究院4 分钟前
Python系列进阶教程(一)Python 面向对象
开发语言·python
郁大锤5 分钟前
Windows 环境下安装 Python 与环境变量配置
开发语言·windows·python
李德没德7 分钟前
零基础快速入门Python:从安装到写出第一个程序
开发语言·python·新人首发