zoukankan      html  css  js  c++  java
  • js点击事件 注册下一步实现代码

    点击事件:

    <body>

    <input type="button" id="btn1"/>

    <input type="button" value="按 钮" onclick="btn_click()" />

    </body>

    <script>

    var btn1=document.getElementById("btn1");
    btn1.onclick=function(){
    alert("点击");
    }              //点击出发事件,第一种方式

    function btn_click(){
    alert("点击");
    }                 //点击出发事件,第二种方式

    </script>

    <body>

    <input type="text" onblur="alert('失去焦点')"/>             //onblur 鼠标点击标签范围外的区域则进行提示
    <select onchange="alert('改变')">                               //onchange改变选项则进行提示
    <option>1</option>
    <option>2</option>
    <option>3</option>
    <option>4</option>
    </select>
    <input type="text" onkeyup="alert('按键抬起')" />                     //onkeyup   输入停止则进行提示
    <img src="../../img/qlrc-t/10292114_b20170717170239.gif"
    onmouseover="alert('鼠标移上')" />                                         // onmouseover  鼠标移到制定区域提示

    </body>

    事件应用实例:同意   =》  下一步

    <body>

    <input type="checkbox" id="c1" />
    <label for="c1">同意</label>
    <input type="button" value="下一步" disabled="disabled" id="btn" />

    </body>

    <script>

    var c1=document.getElementById('c1');
    var btn=document.getElementById('btn');

    c1.onchange=function(){
    if(!c1.checked){
    btn.setAttribute("disabled","disabled");
    }else{
    btn.removeAttribute("disabled");
    }
    }

    </script>

  • 相关阅读:
    PHP一维数组转二维数组正则表达式
    PHP IDE选择标准
    PHP导出MySQL数据字典 Summer-Mysql-Dic
    PHP导入导出csv文件 Summer-CSV
    laravel学习
    php markdown 接口文档生成工具 SummerDoc
    AIX系统日志
    inotify+rsync实现实时同步
    shell数组应用
    Nginx缓存功能、防盗链、URL重写
  • 原文地址:https://www.cnblogs.com/dej-11/p/7446046.html
Copyright © 2011-2022 走看看