<input type="radio" id="all" value="1" name="executeRadio"  <s:if test="bankApointDateDayCondtion!=null">checked="checked"</s:if> >

var redioCount = 0;
    $(document).ready(function (){

   if($("#all").attr("checked")=="checked") redioCount=1;
        $("input[type='radio']").click(function(){
           if(redioCount == 1){
                $(this).removeAttr("checked");
                redioCount=0;
           }else {
                $(this).attr("checked","checked");
                redioCount=1;
            }
        });

})

实例:

<input type="radio" id="all" value="1" name="executeRadio"  <s:if test="bankApointDateDayCondtion!=null">checked="checked"</s:if> > 每周指定日执行

<table border="0" width="100%" align="center" cellpadding="2"
                                        cellspacing="5" >
                                    <tr>                
                                        <td><input type="checkbox" name="bankApointDateDayCondtions" <s:if test="withdrawConfig.bankApointDateDayCondtion==null">disabled="disabled"</s:if> ${withdrawConfig.isSun==1?"checked":""} value="1"></td>
                                        <td><input type="checkbox" name="bankApointDateDayCondtions" <s:if test="withdrawConfig.bankApointDateDayCondtion==null">disabled="disabled"</s:if> ${withdrawConfig.isMon==1?"checked":""} value="2"></td>
                                        <td><input type="checkbox" name="bankApointDateDayCondtions" <s:if test="withdrawConfig.bankApointDateDayCondtion==null">disabled="disabled"</s:if> ${withdrawConfig.isTue==1?"checked":""} value="3"></td>
                                        <td><input type="checkbox" name="bankApointDateDayCondtions" <s:if test="withdrawConfig.bankApointDateDayCondtion==null">disabled="disabled"</s:if> ${withdrawConfig.isWed==1?"checked":""} value="4"></td>
                                        <td><input type="checkbox" name="bankApointDateDayCondtions" <s:if test="withdrawConfig.bankApointDateDayCondtion==null">disabled="disabled"</s:if> ${withdrawConfig.isThur==1?"checked":""} value="5"></td>
                                        <td><input type="checkbox" name="bankApointDateDayCondtions" <s:if test="withdrawConfig.bankApointDateDayCondtion==null">disabled="disabled"</s:if> ${withdrawConfig.isFri==1?"checked":""} value="6"></td>
                                        <td><input type="checkbox" name="bankApointDateDayCondtions" <s:if test="withdrawConfig.bankApointDateDayCondtion==null">disabled="disabled"</s:if> ${withdrawConfig.isSat==1?"checked":""} value="7"></td>
                                        
                                    </tr>
                                    <tr>                
                                        <td>周日</td>
                                        <td>周一</td>
                                        <td>周二</td>
                                        <td>周三</td>
                                        <td>周四</td>
                                        <td>周五</td>
                                        <td>周六</td>
                                    </tr>
                                </table>

  var redioCount = 0;
    $(document).ready(function (){

   if($("#all").attr("checked")=="checked") redioCount=1;
        $("input[type='radio']").click(function(){
           if(redioCount == 1){
                $(this).removeAttr("checked");
                
                $("input[name='bankApointDateDayCondtions']").each(function(){
                    $(this).attr("disabled","disabled");
                    $(this).removeAttr("checked");
                });
                redioCount=0;
           }else {
                $(this).attr("checked","checked");
                $("input[name='bankApointDateDayCondtions']").each(function(){
                    $(this).removeAttr("disabled");
                });
                redioCount=1;
            }
        });

})

function submitForm(){

  if($("#all").attr("checked")!=undefined ){//勾选
            var checkArry = document.getElementsByName("bankApointDateDayCondtions");
            var isChecked=false;
            for (var i = 0; i < checkArry.length; i++) {
                if(checkArry[i].checked == true){
                    isChecked=true;
                }
            }
            if(!isChecked){
                alert("请选择指定执行的日期!");
                return false;
            }
        }

}

只有一个radio的单选框如何在选中后取消选中的更多相关文章

  1. jQuery操作复选框checkbox技巧总结 ---- 设置选中、取消选中、获取被选中的值、判断是否选中等

    转载:https://blog.csdn.net/chenchunlin526/article/details/77448168 jQuery操作复选框checkbox技巧总结 --- 设置选中.取消 ...

  2. JQuery判断radio(单选框)是否选中和获取选中值

    一.设置选中方法 代码如下: $("input[name='名字']").get(0).checked=true; $("input[name='名字']"). ...

  3. radio(单选框)反复选中与取消选中

    做个记录,以便需要拿取 <script type="text/javascript"> $(function(){ 第一种 $('input:radio').click ...

  4. 使用jquery实现单选框、多选框取消选中状态

    function radioReset(){ /*方式一*/ /* var radios = $("input[type='radio']"); for (i=0; i<ra ...

  5. 用js写出一个漂亮的单选框选中效果

    一般的input框比较简单,我们可以用JavaScript配合css背景图片定位让我们模拟写出一个点击选中效果 首先需要有个图片素材,当页面加载的时候是背景图片定位到左图,当我们点击图片的时候,背景图 ...

  6. prop解决一个checkbox选中后再次选中失效的问题

    //问题点 初始状态复选框没有全选, 点击全选按钮调用checkAll方法, 实现了全选, 然后点击全不选按钮, 实现了全不选, 然后再次点击全选按钮, 结果却木有全选, 再反复点击木有任何反应. d ...

  7. 【六】jquery之HTML代码/文本/值[下拉列表框、多选框、单选框的选中]

    val()方法不仅能设置元素的值,同时也能获取元素的值.另外,val()方法还有另外一个用处,就是它能使select(下拉列表框).checkbox(多选框)和radio(单选框)相应的选项被选中,在 ...

  8. JQuery radio单选框应用

    转载:JQuery判断radio(单选框)是否选中和获取选中值方法总结 一.利用获取选中值判断选中 直接上代码,别忘记引用JQuery包 复制代码 代码如下: < !DOCTYPE html P ...

  9. 【三石jQuery视频教程】02.创建 FontAwesome 复选框和单选框

    视频地址:http://v.qq.com/page/m/8/c/m0150izlt8c.html 大家好,欢迎来到[三石jQuery视频教程],我是您的老朋友 - 三生石上. 今天,我们要通过基本的H ...

随机推荐

  1. WPF控件 RichTextBox查找定位匹配字符

    private void Search_Click(object sender, RoutedEventArgs e)//查询定位文本 { List<TextRange> textRang ...

  2. Win7系统安装好Axure点击运行报.NET Framework4.0未安装的解决办法

      1:问题 由于工作需要,需要研究一下Axure原型设计软件的使用方式,在公司的电脑上成功安装了从同事那里拿来的Axure7.0软件,能够正确运行没有任何问题,在自己的电脑上安装的也非常顺利,不过运 ...

  3. git 删除untracked 文件(转载)

    From:http://zhidao.baidu.com/question/983440344933263859.html git clean命令可以删除未被版本库跟踪的文件或目录. # 删除 unt ...

  4. logstash 配置 logstash-forwarder (前名称:lumberjack)

    logstash-forwarder(曾名lumberjack)是一个用go语言写的日志发送端, 主要是为一些机器性能不足,有性能强迫症的患者准备的. 主要功能: 通过配置的信任关系,把被监控机器的日 ...

  5. 利用Continuous Testing实现Eclipse环境自动单元测试

    当你Eclipse环境中修改项目中的某个方法时,你可能由于各种原因没有运行单元测试,结果代码提交,悲剧就可能随之而来. 所幸infinitest(http://infinitest.github.io ...

  6. wcf序列化大对象时报错:读取 XML 数据时,超出最大

    错误为: 访问服务异常:格式化程序尝试对消息反序列化时引发异常: 尝试对参数 http://tempuri.org/ 进行反序列化时出 错: request.InnerException 消息是“反序 ...

  7. 转载-------makefile 使用总结

    转载自:http://www.cnblogs.com/wang_yb/p/3990952.html 1. Makefile 简介 Makefile 是和 make 命令一起配合使用的. 很多大型项目的 ...

  8. 编译安装带ssl 模块指定版本Python

      出现这个或者fatal error: openssl/名单.h: No such file or directory.都是没有安装libssl-dev- libssl-dev包含libraries ...

  9. public static void Invoke (Action action)

    using System; using System.Security.Principal; using System.Security.Permissions; namespace Demo { c ...

  10. ReferenceError: $ is not defined (绝对路径和相对路径)

    今天使用JQuery时,进入js文件后一直达不到想要的效果,在firebug上调试后发现报错提示"ReferenceError: $ is not defined",显然,这是JQ ...