這篇文章帶給大家的內容是關於phpcms後台全選和全不選如何實現?(附代碼),有一定的參考價值,有需要的朋友可以參考一下,希望對你有所幫助。
html程式碼
1 2 3 4 5 6 7 | <th width= "5%" ><input value= "" id= "check_box" onclick= "selectallForAuditions('ids[]');" type= "checkbox" /></th>
<td align= "center" >
<input id= "course_<?php echo $r['id']; ?>" class = "inputcheckbox" onclick= "chooseCourse(<?php echo $r['id']; ?>)" name= "ids[]" value= "<?php echo $r['id']; ?>" type= "checkbox" >
</td>
|
登入後複製
jquery的程式碼
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | function selectallForAuditions(name) {
if ($( "#check_box" ).attr( "checked" )=='checked') {
$( "input[name='" +name+ "']" ).each( function () {
$(this).prop( "checked" , "checked" );
chooseAllCourse($(this).val());
});
} else {
$( "input[name='" +name+ "']" ).each( function () {
$(this).removeAttr( "checked" );
});
}
}
function chooseAllCourse(courseId) {
var strKeyName = auditions + "_courseId_" + courseId;
localStorage.setItem(strKeyName, courseId);
getCourse();
}
|
登入後複製
相關建議:
phpcms安裝完成後總是跳到install/install. php,phpcms安裝
PHPCMS建置wap手機網站,phpcms搭建wap
以上是phpcms後台全選和全不選如何實作?(附程式碼)的詳細內容。更多資訊請關注PHP中文網其他相關文章!