码迷,mamicode.com
首页 > 其他好文 > 详细

radio中最佳解决方案

时间:2017-05-30 00:07:59      阅读:219      评论:0      收藏:0      [点我收藏+]

标签:div   put   htm   bsp   禁用   javascrip   启用   asc   nbsp   

radio中最佳解决方案

1、html中

              <td>
                      <input id="status" name="status" type="radio" value="1" checked="checked" onclick="qy()"/>
                      <span>启用</span>
                      <input id="status" name="status" type="radio" value="0"  onclick="jy()"/>
                       <span>禁用</span>
               </td>

2、js中

    function qy(){
        $("input[name=‘status‘]").eq(0).attr("checked","checked");
        $("input[name=‘status‘]").eq(1).removeAttr("checked");
        $(‘input[name="status"]:eq(0)‘).attr("value", 1);
        return;
    };
    function jy(){
        $("input[name=‘status‘]").eq(0).removeAttr("checked");
        $("input[name=‘status‘]").eq(1).attr("checked","checked");
        $(‘input[name="status"]:eq(1)‘).attr("value", 0);
        return;
    };

 

radio中最佳解决方案

标签:div   put   htm   bsp   禁用   javascrip   启用   asc   nbsp   

原文地址:http://www.cnblogs.com/denied/p/6919368.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!