zoukankan      html  css  js  c++  java
  • checkbox控制text是否可以填写和radio是否可选

    代码:

    <!DOCTYPE html>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>开启/禁止输入</title>
    <script src="jquery-1.7.1.js"></script>
    <script type="text/javascript">
    function reset() {
        $("#zt").attr("checked",false);
        $("#yj").attr("checked",false);
        $("#sj").attr("checked",false);
        $("input[type='radio']").removeAttr('checked');
        $("#f1").attr("disabled","disabled");
        $("#f2").attr("disabled","disabled");
        $("#jg").val("");
        $("#jg").attr("disabled","disabled");
        $("#yx").textbox('setValue','');
        $('#yx').textbox('readonly',true);
    }
    
    function fszt() {
    //            if($('#zt').prop("checked")&&$('#yj').prop("checked")){
    //                $.messager.alert('系统提示', '只能选择一个', 'info');
    //                $("#zt").attr("checked",false);
    //                return
    //            }
    //            if($('#zt').prop("checked")&&$('#sj').prop("checked")){
    //                $.messager.alert('系统提示', '只能选择一个', 'info');
    //                $("#zt").attr("checked",false);
    //                return
    //            }
                if($('#zt').prop("checked")){//判断checkbox是否选中
                    //选中状态
                    $("#f1").removeAttr("disabled");
                    $("#f2").removeAttr("disabled");
                }else{
                    //未选中状态
                    $("#f1").attr("disabled","disabled");
                    $("#f2").attr("disabled","disabled");
                }
            }
            function yjjg() {
    //            if($('#yj').prop("checked")&&$('#zt').prop("checked")){
    //                $.messager.alert('系统提示', '只能选择一个', 'info');
    //                $("#yj").attr("checked",false);
    //                return
    //            }
    //            if($('#yj').prop("checked")&&$('#sj').prop("checked")){
    //                $.messager.alert('系统提示', '只能选择一个', 'info');
    //                $("#yj").attr("checked",false);
    //                return
    //            }
                if($('#yj').prop("checked")){//判断checkbox是否选中
                    //选中状态
                    $("#jg").removeAttr("disabled");
                }else{
                    //未选中状态
                    $("#jg").attr("disabled","disabled");
                }
            }
            function sjr() {
    //            if($('#sj').prop("checked")&&$('#zt').prop("checked")){
    //                $.messager.alert('系统提示', '只能选择一个', 'info');
    //                $("#sj").attr("checked",false);
    //                return
    //            }
    //            if($('#sj').prop("checked")&&$('#yj').prop("checked")){
    //                $.messager.alert('系统提示', '只能选择一个', 'info');
    //                $("#sj").attr("checked",false);
    //                return
    //            }
                if($('#sj').prop("checked")){//判断checkbox是否选中
                    //选中状态
                    $('#yx').textbox('readonly',false);
                }else{
                    //未选中状态
                    $('#yx').textbox('readonly',true);
                }
            }
    </script>
    </head>
    <body>
    <table>
        <tr>
            <td style="text-align: right;font-size: 15px" ><input id="zt" type="checkbox" onclick="fszt()">发送状态:</td>
            <td style="font-size: 15px" ><input disabled="disabled" id="f1" type="radio" name="flag" value="1">开启
            <input disabled="disabled" id="f2" type="radio" name="flag" value="0">关闭</td>
        </tr>
        <tr>
            <td style="text-align: right;font-size: 15px" ><input id="yj" type="checkbox" onclick="yjjg()">邮件间隔:</td>
            <td style="font-size: 15px" >&nbsp;<input disabled="disabled" id="jg" type="text" name="interval">(分)</td>
        </tr>
        <tr>
            <td style="text-align: right;font-size: 15px" ><input id="sj" type="checkbox" onclick="sjr()">收件人:<br>(easyui)</td>
            <td>&nbsp;<input id="yx" name="sjryx" readonly="readonly" class="easyui-textbox" type="text" style="300px;height:100px" data-options="prompt:'多个邮件用英文逗号隔开',multiline:true"></input></td>
        </tr>
    </table>
    <button onclick="reset()">点我还原</button>
    </body>
    </html>
  • 相关阅读:
    Ecshop去掉模版中随机出现Ecshop版权的方法
    ecshop邮件订阅按“订阅”没反应
    ecshop开发帮助
    ecshop循环计数
    ECSHOP购物车页面显示商品简单描述
    ecshop 函数列表大全
    ecshop 商品分类页 取得当前分类下的子分类方法
    ecshop调用指定分类和个数的文章列表
    thymeleaf中的th:assert用法
    thymeleaf中的模板布局
  • 原文地址:https://www.cnblogs.com/raitorei/p/9877813.html
Copyright © 2011-2022 走看看