<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. 在UIView上添加tableView设置代理属性

  2. 动画--问题追踪:ImageView执行缩放动画ScaleAnimation之后,图像显示不全的问题。

    http://www.bkjia.com/Androidjc/929473.html: 问题追踪:ImageView执行缩放动画ScaleAnimation之后,图像显示不全的问题., 问题:我有一个 ...

  3. 百度地图API功能集锦

    1.点个数太多导致加载缓慢的解决. 2.可视化区域内加载的解决. 3.自定义信息窗口解决. 4.区域/板块/商圈等的绘制功能解决. 基本包含了用到百度地图API会使用到的大部分常规性场景.(聚合点功能 ...

  4. 前端模板之EasyUI常用控件及参数

    CSS类定义 div easyui-window window窗口样式 属性如下: 1) modal:是否生成模态窗口.true[是] false[否] 2) shadow:是否显示窗口阴影.true ...

  5. MySQL中tinytext、text、mediumtext和longtext详解

    一.数字类型 类型 范围 说明   Char(N) [binary] N=1~255 个字元binary :分辨大小写 固定长度 std_name cahr(32) not null VarChar( ...

  6. delphi.thread.线程循环执行体结构

    线程话题太大,又都是些坑,不知从哪方面讲起,所以,想一出是一出了. 不管怎样,我们从开始使用D,不管有没有用线程,其实它已经帮我们做了一个最完整的线程执行处理:Application.Run. 这行A ...

  7. centos 解压jdk安装包方式安装jdk 出现 java/lang/NoClassDefFoundError: java/lang/Object 错误

    安装完JDK ,设定环境变量后出现这个错误: [root@localhost lib]# javacError occurred during initialization of VMjava/lan ...

  8. 用:before :after 来写一些小特效

    提起:before :after首先想到的是 —— 用它来去浮动来我们来换个方式玩接下来展示三种用:before :after来实现的特效 希望能起到抛砖引玉的作用 <一>第一种就是常见的 ...

  9. leetcode-【中等题】5. Longest Palindromic Substring

    题目 Given a string S, find the longest palindromic substring in S. You may assume that the maximum le ...

  10. js prepend() 和append()区别

    prepend() 方法在被选元素的开头(仍位于内部)插入指定内容.prepend() 语法:$(selector).prepend(content) 或 $(selector).prepend(fu ...