• 【特效】复选框分行控制文本框


    也是实际项目中遇到的一个小小效果,意义不大,就是复习了一下if表达式中,复选框被选中了怎么写。

    html:

    <table class="box">

             <tr>

                 <td><input type="checkbox" class="check_1"></td>

            <td><input type="text" class="text_1" disabled></td>

        </tr>

        <tr>

                 <td><input type="checkbox" class="check_1"></td>

            <td><input type="text" class="text_1" disabled></td>

        </tr>

        <tr>

                 <td><input type="checkbox" class="check_1"></td>

            <td><input type="text" class="text_1" disabled></td>

        </tr>

    </table>

    css:

    table{ 800px; margin:100px 0 0 100px; border-collapse:collapse;}

    .box td{ height:60px; border:1px solid #ccc; padding:0 20px;}

    .text_1{ 300px; padding:0 10px; height:35px; border:1px solid #ccc; background:#fff;}

    js:

    <script>

    $(document).ready(function(){

             var check=$(".check_1");

             var text=$(".text_1");

             check.each(function(){

                       $(this).click(function(){

                                if(this.checked){

                                         $(this).parents("tr").find(".text_1").attr("disabled",false).css("border","1px solid #000");

                                         }

                                else{

                                         $(this).parents("tr").find(".text_1").attr("disabled",true).css("border","1px solid #ccc");

                                         }

                                });

                       });

    });

    </script>

    效果预览:http://www.gbtags.com/gb/rtreplayerpreview-standalone/2917.htm

    源码下载:http://pan.baidu.com/s/1eSz7Dzs

  • 相关阅读:
    Flask第二篇——服务器相关
    Flask第一篇——URL详解
    Appium 定位方法例子(4)
    selenium 上传文件方法补充——SendKeys、win32gui
    Appium+python (3) 异常处理
    Appium+python (3) 元素定位(1)
    "http://127.0.0.1:4723/wd/hub"的解释
    Appium + Python App自动化(2)第一个脚本
    Appium+python(1)简单的介绍环境搭建
    用fiddler设置手机代理
  • 原文地址:https://www.cnblogs.com/xiaoxianweb/p/5704177.html
Copyright © 2020-2023  润新知