The content of this article is about how to implement all selection and none selection in phpcms background? (Attached code), it has certain reference value, friends in need can refer to it, I hope it will be helpful to you .
html code
//标题里面的复选框 <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 code
function selectallForAuditions(name) { if ($("#check_box").attr("checked")=='checked') { $("input[name='"+name+"']").each(function() { //全选jq代码 $(this).prop("checked","checked"); chooseAllCourse($(this).val()); }); } else { $("input[name='"+name+"']").each(function() { //都不选jq的代码 $(this).removeAttr("checked"); }); } } //全选课程 function chooseAllCourse(courseId) { var strKeyName = auditions + "_courseId_" + courseId; localStorage.setItem(strKeyName, courseId); getCourse(); }
Related recommendations:
phpcms always jumps to install/install after the installation is completed. php, phpcms installation
PHPCMS builds wap mobile website, phpcms builds wap
The above is the detailed content of How to achieve all selection and none selection in phpcms background? (Code attached). For more information, please follow other related articles on the PHP Chinese website!