zoukankan      html  css  js  c++  java
  • 自定义属性应用1

    <!DOCTYPE html>
    <html>
        <head>
            <meta charset="UTF-8">
            <title></title>
            <script>
                window.onload = function(){
                    var aBtn = document.getElementsByTagName('input');
                    var aP = document.getElementsByTagName('p');
                    var arr=['kk','li','ll'];
                    for(var i = 0;i<aBtn.length;i++){
                        aBtn[i].index= i;
                        aBtn[i].onclick = function(){
                            this.value = arr[this.index];
                            aP[this.index].innerHTML = arr[this.index];
                        }
                    }
                }
            </script>
        </head>
        <body>
            <input type="button" value="btn1"/>
            <input type="button" value="btn2"/>
            <input type="button" value="btn3"/>
            <p>5</p>
            <p>7</p>
            <p>9</p>
        </body>
    </html>
    示例代码
  • 相关阅读:
    Python Day13:开放封闭原则、函数装饰器、全局局部变量
    Python Day12
    Python Day11
    Python Day10
    drf框架
    drf框架
    drf框架
    drf框架
    vue框架
    vue框架
  • 原文地址:https://www.cnblogs.com/linjiaxiaomeiainia/p/6905352.html
Copyright © 2011-2022 走看看