<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;
}
}
}