zoukankan      html  css  js  c++  java
  • input type = button 的onclick属性调用函数

    调用js函数

    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="utf-8">
    <script src="https://cdn.static.runoob.com/libs/jquery/1.10.2/jquery.min.js">
    </script>
    <script>
     function fas(){
        alert(1);
     }
    </script>
    </head>
    <body>
        <input type="button" onclick = "fas()" value = "sdsdsd">
    </body>
    </html>
    

    JQuery调用

    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="utf-8">
    <script src="https://cdn.static.runoob.com/libs/jquery/1.10.2/jquery.min.js">
    </script>
    <script>
    $(function(){
     $("#test").click(function(){
        alert(1);
    });
    });
    </script>
    </head>
    <body>
        <input id = "test" type="button" value = "sdsdsd">    //无onclick,隐含调用
    </body>
    </html>
    
    

      

  • 相关阅读:
    小数的进制转换
    水题 O
    水题 J
    水题T,二进制转16进制
    水题B
    水题C
    HDU 2042
    HDU 2041
    Index For SQL Server
    Learning Note For Angular
  • 原文地址:https://www.cnblogs.com/wfy680/p/14537253.html
Copyright © 2011-2022 走看看