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>

在控制台直接打印出来

相关推荐
xcyxiner2 分钟前
DicomViewer24 修复编译bug(window test 失败)
前端·qt
linux_cfan32 分钟前
videojs v10 源代码系列解读:34 · `createComposition`:类型安全的冲突检测
前端·安全
周杰偷奶茶1 小时前
【Java】数组的定义和使用(附管理系统实战案例)
java·开发语言
橙子圆1231 小时前
JUC之集合类不安全
java·开发语言
阿里嘎多学长1 小时前
2026-09-29 GitHub 热点项目精选
开发语言·程序员·github·代码托管
Bruce_Liuxiaowei2 小时前
网页版 DeepSeek “harness desktop“ WebGL 上下文创建失败排查实录
开发语言·javascript·webgl
utmhikari2 小时前
【AI原生】借助AI之力优化个人博客前端样式
前端·css·hexo·next·个人博客·ai-native·vibe coding
weixin_416667962 小时前
银河麒麟V10看门狗试验-1
网络·chrome·python
狗凯之家源码网2 小时前
PHP 用户反馈系统源码深度评测与实战指南
开发语言·php·用户反馈系统