• Dom选择器使用与调试记录


    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>Title</title>
    </head>
    <body>
        <div id="#12">我喜欢学习python</div>
        <a>123</a>
        <a>456</a>
        <a>789</a>
    
    </body>
    </html>
    
    document.getElementById('#12')
    <div id=​"#12">​我喜欢学习python​</div>​
    document.getElementById('#12').innerText
    "我喜欢学习python"
    document.getElementById('#12').innerText="我也超级喜欢"
    "我也超级喜欢"
    document.getElementsByTagName('a')[1]
    <a>​456​</a>​
    document.getElementsByTagName('a')[1].innerText='qwe'
    "qwe"
    msg = document.getElementsByTagName('a')
    HTMLCollection(3) [a, a, a]
    for(var i=0;i<msg;i++){msg[i].innerText=111}
    undefined
    for(var i=0;i<msg;i++){msg[i].innerText=111;}
    undefined
    for(var i=0;i<msg.length;i++){msg[i].innerText=111}
    111
    
  • 相关阅读:
    angular.js 渲染
    HTML5 与 CSS3 jQuery部分知识总结
    下拉滚动协议文本框展示样式(不可删除文本内容)
    06对象
    05数组
    1文字与字体
    04函数
    03循环
    02运算符
    01基础
  • 原文地址:https://www.cnblogs.com/qiangayz/p/8720546.html
Copyright © 2020-2023  润新知