jquery对同级的td做radio限制
<html> <head> <title></title> <script src="http://libs.baidu.com/jquery/1.10.2/jquery.min.js"> </script> <script type="text/javascript"> function CheckSex1(str){ alert(str); var rs = $(".ra"); rs.attr("disabled","disabled"); } function CheckSex(str){ $(":radio").removeAttr("disabled"); $("tr .woman").prev(":radio").removeAttr("checked"); $("tr .man").prev(":radio").removeAttr("checked"); $("tr .hraf").prev(":radio").removeAttr("checked"); if(str == "man"){ var te = $("tr .woman"); var ra = te.prev(":radio"); ra.attr("disabled","disabled"); }else if(str == "woman"){ var te = $("tr .man"); var ra = te.prev(":radio"); ra.attr("disabled","disabled"); } } </script> <body> <table border="1" align="center" class="tyouhyou_11pt" cellpadding="0" cellspacing="0" width="530"> <tr class="tyouhyou_9pt" height="20"> <td width="30" align="center"><input type="radio" name="checkStaff" value="" onclick="CheckSex('man');"/></td> <td width="90" align="center"><a onclick="jumpNewWindow('xx')"></a></td> <td width="30" align="center">20</td> <td width="30" align="center">man</td> <td width="90" align="center">13545810125</td> <td width="90" align="center">027-51879974</td> <td width="90" align="center">2015-01-24</td> <td width="80" align="center">1</td> </tr> <tr class="tyouhyou_9pt" height="20"> <td width="30" align="center"><input type="radio" name="checkStaff" value="" onclick="CheckSex('woman');"/></td> <td width="90" align="center"><a onclick="jumpNewWindow('xx')"></a></td> <td width="30" align="center">20</td> <td width="30" align="center">woman</td> <td width="90" align="center">13545810125</td> <td width="90" align="center">027-51879974</td> <td width="90" align="center">2015-01-24</td> <td width="80" align="center">1</td> </tr> </table> <table border="1" align="center" class="tyouhyou_11pt" cellpadding="0" cellspacing="0" width="530"> <tr class="tyouhyou_9pt" height="30"> <td width="120" align="center" bgcolor="#FFB56A">neirong</td> <td width="145" align="center">mingzi</td> <td width="120" align="center" bgcolor="#FFB56A">changsuo</td> <td width="145" align="center">yewuming</td> </tr> <tr class="tyouhyou_9pt" height="30"> <td align="left" colspan="4">2015-05-25</td> </tr> <tr class="tyouhyou_9pt" height="30"> <td align="left" colspan="4"> 08:18-19:00 <input type="radio" class="ra" name="344963duty" value="344952" /> </td> </tr> <tr class="tyouhyou_9pt" height="30"> <td align="left" colspan="4"> 09:18-20:00 <input type="radio" class="ra" name="344963duty" value="344952" /> <input type="hidden" class="woman" value="2"/> </td> </tr> <tr class="tyouhyou_9pt" height="30"> <td align="left" colspan="4">2015-05-26</td> </tr> <tr class="tyouhyou_9pt" height="30"> <td align="left" colspan="4"> 10:18-19:00 <input type="radio" class="ra" name="344963duty" value="344952" /> <input type="hidden" class="man" value="1"/> </td> </tr> <tr class="tyouhyou_9pt" height="30"> <td align="left" colspan="4"> 13:18-20:00 <input type="radio" class="ra" name="344963duty" value="344952" /> <input type="hidden" class="woman" value="2"/> </td> </tr> <tr class="tyouhyou_9pt" height="30"> <td align="left" colspan="4"> 18:18-20:00 <input type="radio" class="ra" name="344963duty" value="344952" /> <input type="hidden" class="hraf" value="3"/> </td> </tr> </table> </body> </html>
能够实现,控制同级的td中的radio 的可选和不可选