• 选择器模块之传统做法

        var tag = function (tag){
            return document.getElementsByTagName(tag);
        }
        var id = function (id){
            return document.getElementById(id);
        }
        var className = function (className){
            return document.getElementsByClassName(className);
        }    
  • 由浅入深之tag方法

 这是html部分代码

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8" />
        <title></title>
        <style type="text/css">
            div, p {
                width: 200px; 
                height:50px; 
                border:1px dashed red; 
                margin: 10px 0;
            }
        </style>
    </head>
    <body>
        <div></div>
        <div></div>
        <p></p>
        <p></p>
    </body>
View Code

相关文章:

  • 2022-12-23
  • 2021-10-01
  • 2021-08-10
  • 2021-10-14
  • 2021-08-19
  • 2021-06-21
  • 2022-01-23
  • 2021-08-15
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-24
  • 2021-11-12
相关资源
相似解决方案