<%@ page language="java" contentType="text/html; charset=utf-8"
pageEncoding="utf-8"%>
<%response.setHeader("Pragma","No-cache");
response.setHeader("Cache-Control","no-cache");
response.setDateHeader("Expires", 0);
response.flushBuffer();%>
<%@ include file="/util/taglib.jsp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" >
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gbk">
<script type="text/javascript">
//级联勾选函数
function getchecks() {
var parentCategorys = document.getElementsByName("parentchk");
for (var k=0; k<parentCategorys.length; k++){
var test = parentCategorys[k];
if (test.checked) {
var id = test.id;
var childs = document.getElementsByName("chk");
var a = 0;
for (var i=0; i<childs.length; i++){
var child = childs[i];
var parentid = child.id;
//alert(id==parentid);
if (id==parentid) {
child.checked = true;
}
}
}else{
continue;
}
}
}
</script>
<title>人群关联度</title>
</head>
<body>
<div class="page">
<div class="pageHeader">
</div>
<div class="pageContent">
<form method="post" id="addre" action="${pageContext.request.contextPath }/exactrelated.do?action=categoryRes&flag=save" class="pageForm required-validate" onsubmit="return validateCallback(this);">
<input type="hidden" name="categoryId" value="${categoryId }"/>
<div class="pageFormContent" layoutH="56" width="60">
<!-- 父类循环,父类被勾选的时候下面的子类都相应的被勾选上 -->
<c:forEach items="${parentCategoryList}" var="m">
<c:if test="${m.pid == 0}">
<p>
<c:choose>
<c:when test="${m.flag==0}">
<label><input type="checkbox" id="${m.categoryId }" name="parentchk" value="${m.categoryId }" checked onclick="getchecks()"/> <font style="color:red">${m.categoryName }</font></label>
</c:when>
<c:otherwise>
<label><input type="checkbox" id="${m.categoryId }" name="parentchk" value="${m.categoryId }" onclick="getchecks()" /> <font style="color:red">${m.categoryName }</font></label>
</c:otherwise>
</c:choose>
</p>
</c:if>
<!-- 子类循环 -->
<c:forEach items="${categoryList}" var="l">
<c:if test="${m.categoryId == l.pid}">
<p>
<c:choose>
<c:when test="${l.flag==0}">
<label><input type="checkbox" flag="${m.categoryId }" id="${l.pid}" name="chk" value="${l.categoryId }" checked/> ${l.categoryName }</label>
</c:when>
<c:otherwise>
<label><input type="checkbox" flag="${m.categoryId }" id="${l.pid }" name="chk" value="${l.categoryId }" /> ${l.categoryName }</label>
</c:otherwise>
</c:choose>
</p>
</c:if>
</c:forEach>
<div class="divider"></div>
</c:forEach>
</div>
<div class="formBar">
<ul>
<li><div class="buttonActive"><div class="buttonContent"><button type="submit">保存</button></div></div></li>
<li>
<div class="button"><div class="buttonContent"><button type="Button" onclick="navTab.closeCurrentTab()">取消</button></div></div>
</li>
</ul>
</div>
</form>
</div>
</div>
</body>
</html>
分享到:
相关推荐
flex tree+checkbox可实现级联勾选
使用javascript实现checkbox级联选择
flex tree+checkbox可实现级联勾选 修改后 修改CheckTreeDemoRenderer.as这个文件中 while (!cursor.afterLast){ if (cursor.current.@state == STATE_CHECKED) { noChecks++; }else if (cursor.current.@state =...
html5 css3制作checkbox多选框选中样式特效
一行代码搞定layui数据表格的表头checkbox复选框隐藏问题。
checkbox 用shift键 级联选择 只需在checkbox 按钮上一个事件
js checkbox全选 反选 取消全部设置表单html复选框勾选
复选框里的值通过表单post方法传入数据库
js特效制作js checkbox复选框全选 反选 取消全部等设置多个表单里面的checkbox复选框勾选特效。内含js代码下载。
1、给QTreeWidget添加复选框,实现部分选中,全部选中。 2、如果部分选中,父级复选框为对勾,则需设置风格。
带CheckBox和级联操作的Tree 带CheckBox和级联操作的Tree 带CheckBox和级联操作的Tree
表单checkbox多选框选择特效是一款多选框美化特效。
js多级联动多选checkbox插件
在ListView中添加CheckBox,实现多选条目
tagsinput.js 实现记录checkbox勾选顺序,并显示在页面上,可传值给后台.zip
js css3表单checkbox多选框选择效果 js css3表单checkbox多选框选择效果
vue基于element-ui的三级CheckBox复选框功能的实现代码
实现table表格checkbox复选框的全选 反选.
Flutter 复选框 有两种:一 是精简版Checkbox复选框 ,二是自带标题和副标题CheckboxListTile复选框