标签:fun bsp var box cti input element button doc
<td><input type="checkbox" name="check" value="{$vo.id}">{$vo.id}</td>
<input type="button" class="yes" value="全選">
<input type="button" class="no" value="全不選">
<input type="button" class="yn" value="反選">
//全選
$(document).on("click",".yes",function () {
var check = document.getElementsByName("check");
for (i=0;i<check.length;i++){
if (check[i].checked==false){
check[i].checked = true;
}
}
})
//全不選
$(document).on("click",".no",function () {
var check = document.getElementsByName("check");
for (i=0;i<check.length;i++){
if (check[i].checked==true){
check[i].checked = false;
}
}
})
//反選
$(document).on("click",".yn",function () {
var check = document.getElementsByName("check");
for (i=0;i<check.length;i++){
if (check[i].checked==true){
check[i].checked = false;
}else {
check[i].checked = true;
}
}
})
标签:fun bsp var box cti input element button doc
原文地址:https://www.cnblogs.com/azzy/p/11748796.html