There are a series of Checkboxes in the GridView, which need to be selected or unselected. I started looking for it online, but the reference code will select all Checkboxes in the GridView, and what I want is to select all in a single column. As shown in the picture:
Audit and permissions must be separated.
I wrote the JavaScript code myself and posted it for your reference.
function chkAll(CheckAll) {
var items = document.getElementsByTagName("input");
for (var i = 0; i < items.length; i ) {
if (items[i].type == "checkbox"){
for (var j = 2; j < 10; j ) {
var id = "ctl00_ContentPlaceHolder1_GridView1_ctl0" j "_CheckBox1";
if (items[i].id == id) {
items[ i].checked = CheckAll.checked;
}
}
}
}
}
Among them, j in line 5 and j in line 6 id is used to determine the Checkbox of the same column. The specific range of j and id may be different. You can use alert(items[i].id); to traverse the entire items to view the corresponding id.
The corresponding code for the front desk is as follows:
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn