我想在单击复选框时禁用一些复选框。以下是我想要实现的内容:
- 如果点击注册替换,则禁用荣誉开除和入学考试。 - 如果点击优良品德证书,则禁用入学考试。 - 如果点击荣誉开除,则禁用文凭、CUE请求、CMI请求和入学考试。 - 如果单击成绩记录表,则禁用CUE请求、CMI请求和入学考试。 - 如果点击入学考试,则禁用所有复选框。
- 如果点击注册替换,则禁用荣誉开除和入学考试。 - 如果点击优良品德证书,则禁用入学考试。 - 如果点击荣誉开除,则禁用文凭、CUE请求、CMI请求和入学考试。 - 如果单击成绩记录表,则禁用CUE请求、CMI请求和入学考试。 - 如果点击入学考试,则禁用所有复选框。
<td><input type = "checkbox"name = "ac_description[]" value = "Replacement_of_Registration" ><b>Replacement of Registration</b>
<td><center><input type="number" name="quantity[]" style="width:60px;" ></center>
</tr>
<tr>
<td><input type = "checkbox"name = "ac_description[]" value = "Good_Moral_Certificate" ><b>Good Moral Certificate</b>
<td><center><input type="number" name="quantity[]" style="width:60px;" ></center>
</tr>
</tr>
<tr>
<td><input type = "checkbox" name = "ac_description[]" value = "Honorable_Dismissal " ><b>Honorable Dismissal</b>
<td><center><input type="number" name="quantity[]" style="width:60px;" ></center>
</tr>
</tr>
<tr>
<td><input type = "checkbox" name = "ac_description[]" value = "Transcript_of_Record"><b>Transcript of Record</b>
<td><center><input type="number" name="quantity[]" style="width:60px;"></center>
</tr>
<tr>
<td><input type = "checkbox" name = "ac_description[]" value = "Diploma"><b>Diploma</b>
<td><center><input type="number" name="quantity[]" style="width:60px;"></center>
</tr>
<tr>
<td><input type = "checkbox" name = "ac_description[]" value = "CUE_Request"><b>CUE Request</b>
<td><center><input type="number" name="quantity[]" style="width:60px;"></center>
</tr>
<tr>
<td><input type = "checkbox" name = "ac_description[]" value = "CMI_Request"><b>CMI Request</b>
<td><center><input type="number" name="quantity[]" style="width:60px;"></center>
</tr>
<tr>
<td><input type = "checkbox" name = "ac_description[]" value = "Entrance_Exam"><b>Entrance Exam</b>
<td><center><input type="number" name="quantity[]" style="width:60px;"></center>
</tr>
<tr>
<td><input type = "checkbox" name = "ac_description[]" value = "School_fees-Medical/Dental_Laboratory "><b>School fees-Medical/Dental Laboratory</b>
<td><center><input type="number" name="quantity[]" style="width:60px;"></center>
</tr>
<tr>
<td><input type = "checkbox" name = "ac_description[]" value = "School_fees-Transcript/Honorable"><b>School fees-Transcript/Honorable</b>
<td><center><input type="number" name="quantity[]" style="width:60px;"></center>
</tr>
<tr>
<td><input type = "checkbox" name = "ac_description[]" value = "School_fees-Library"><b>School fees-Library</b>
<td><center><input type="number" name="quantity[]" style="width:60px;"></center>
</tr>
<tr>
<td><input type = "checkbox" name = "ac_description[]" value = "Affiliation_Fees"><b>Affiliation Fees</b>
<td><center><input type="number" name="quantity[]" style="width:60px;"></center>
</tr>
<script language = "JavaScript">
$("input[type='checkbox']").click(function(){
var val = $(this).attr('value');
switch(val) {
case 'Replacement_of_Registration':
if($(this).is(':checked'))
$("input[value='Honorable_Dismissal '], input[value='Entrance_Exam']").prop('disabled',true);
else
$("input[value='Honorable_Dismissal '], input[value='Entrance_Exam']").prop('disabled',false);
break;
case 'Good_Moral_Certificate':
if($(this).is(':checked'))
$("input[value='Entrance_Exam']").prop('disabled',true);
else
$("input[value='Entrance_Exam']").prop('disabled',false);
break;
case 'Honorable_Dismissal ':
if($(this).is(':checked'))
$("input[value='Diploma'], input[value='CUE_Request'], input[value='CMI_Request'], input[value='Entrance_Exam']").prop('disabled',true);
else
$("input[value='Diploma'], input[value='CUE_Request'], input[value='CMI_Request'], input[value='Entrance_Exam']").prop('disabled',false);
break;
case 'Transcript_of_Record':
if($(this).is(':checked'))
$("input[value='CUE_Request'], input[value='CMI_Request'], input[value='Entrance_Exam']").prop('disabled',true);
else
$("input[value='CUE_Request'], input[value='CMI_Request'], input[value='Entrance_Exam']").prop('disabled',false);
break;
case 'Entrance_Exam':
if($(this).is(':checked'))
$("input[name='ac_description[]']").not(this).prop('disabled',true);
else
$("input[name='ac_description[]']").not(this).prop('disabled',false);
break;
});
$('.class_name').each( function(){
$this.onClick( function(){
if( $(this).is(':checked') ){
$('.class_name').each( function(){
if( $(this).not(':checked') ){
$(this).prop('disabled', true);
}
})
}
</script>
$this.onClick( function(){})
中存在一些错误,$this
是什么,它是否具有onclick
函数? - JiangangXiong