zoukankan      html  css  js  c++  java
  • 表单元素操作,button,点击下载按钮实现-长知识

    禁用按钮

    <!doctype html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>Document</title>
    </head>
    <body>
    <button id="btn">Click Me</button>
    <script>
        var obtn = document.getElementById('btn');
    
        obtn.onclick = function () {
    //        this.disabled = true;
    //        this.setAttribute('disabled', 'true');
        }
    
    </script>
    </body>
    </html>

    小技巧:

     location.href 实现点击下载功能

    http://www.cnblogs.com/zichi/p/4929930.html

    45个JavaScript小技巧

    http://www.cnblogs.com/zichi/p/5094902.html

    【优雅代码】深入浅出 妙用Javascript中apply、call、bind
    http://www.cnblogs.com/coco1s/p/4833199.html

    常用的表单事件及用法--select option


    记录一下常用的表单事件,因为工作中常用到所以特别记录一下。有jq写法和原生js写法

    1.这是select的option的事件,jq写法

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="UTF-8" />
    <title>Document</title>
    <script src="../jquery-1.10.2.min.js"></script>
    <script type="text/javascript">
    $(function () {
    
        $('#sel').change(function () {
            
            console.log( $(this).val() );
        })
        
    })
    
    </script>
    </head>
    <body>
        <select name="" id="sel">
            <option value="aaa" selected="selected">111</option>
            <option value="bbb">222</option>
            <option value="ccc">333</option>
        </select>
        <p>
            jQuery中获得选中select值
            var checkText=$("#select_id").find("option:selected").text();  //获取Select选择的Text
            var checkValue=$("#select_id").val();  //获取Select选择的Value
            var checkIndex=$("#select_id ").get(0).selectedIndex;  //获取Select选择的索引值
            var maxIndex=$("#select_id option:last").attr("index");  //获取Select最大的索引值
        </p>
        <p>来源:http://www.cnblogs.com/mitang/p/3687353.html</p>
    </body>
    </html>

    HTML 下拉框 select option 详解
    http://blog.csdn.net/sanyuesan0000/article/details/8593863

  • 相关阅读:
    查看日志
    MySQL连接方式和启动方式
    day03--MySQL用户篇
    MySQL5.6与5.7区别
    Ansible部署主从复制
    day03--MySQL多实例及多实例主从
    MySQL体系结构
    day02-mysql编译安装误删除用户恢复
    数据库包获取方式
    day01--数据库介绍及二进制安装MySQL5.6
  • 原文地址:https://www.cnblogs.com/masita/p/5039134.html
Copyright © 2011-2022 走看看