智能管理系统的楼层房屋位置选择代码

智能管理系统的楼层房屋位置选择代码

添加时间:2021-03-18 15:50:45
站长推荐丨赞助论坛,可获取海量资源终身免费下载权限奥!
举报 举报
收藏
预览
附件 附件
  • 模板类型模板类型:全选 反选
  • 模板颜色模板颜色:初级
  • 下载积分下载积分:28 米粒
  • 下载权限下载权限:

    赞助会员

一款智能管理系统的楼层房屋位置选择代码,可以点击表格的任意单元格进行选择,重复点击同一个单元格则为取消选择,支持单选、多选、整行选择、多行选择等,自由度还是比较高的,选中的单元格则改变背景色显示,喜欢的童鞋请收下吧。
智能管理系统的楼层房屋位置选择代码
分类:表单代码 > 全选 反选 难易:初级

页面的head部分,需引入bootstrap-3.3.4样式库、jQuery库和bootstrap-3.3.4.js,并简单设置页面元素的样式,代码如下:

<link type="text/css" rel="stylesheet" href="css/bootstrap-3.3.4.css">
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/bootstrap-3.3.4.js"></script>
<style type="text/css">
.bgs {
	background: #00B3EE;
	color: #fff;
}
</style>

页面的body部分,主要时一个table,结构并不复杂,代码如下:

<table class="floor table table-striped table-hover" id="aaa">
<tbody>
	<tr>
		<td rowspan="3" onclick="choiceTitle(this)">五栋-1单元-选择栋</td>
		<td class="bgTd" onclick="choiceFloor(this)" unit="1">11楼</td>
		<td class="bgTd" onclick="choiceFloor(this)" unit="1">12楼</td>
		<td class="bgTd" onclick="choiceFloor(this)" unit="1">13楼</td>
		<td class="bgTd"onclick="choiceFloor(this)" unit="1">14楼</td>
		<td class="bgTd" onclick="choiceFloor(this)" unit="1">15楼</td>
		<td class="bgTd" onclick="choiceFloor(this)" unit="1">16楼</td>
		<td class="bgTd" onclick="choiceFloor(this)" unit="1">17楼</td>
		<td class="bgTd" onclick="choiceFloor(this)" unit="1">18楼</td>
		<td class="bgTd" onclick="choiceFloor(this)" unit="1">19楼</td>
		<td class="bgTd" onclick="choiceFloor(this)" unit="1">20楼</td>
		<td onclick="transverse(this)" type="0">选择行</td>
	</tr>
	<tr>
		<td class="bgTd" onclick="choiceFloor(this)" unit="1">11楼</td>
		<td class="bgTd" onclick="choiceFloor(this)" unit="1">12楼</td>
		<td class="bgTd" onclick="choiceFloor(this)" unit="1">13楼</td>
		<td class="bgTd"onclick="choiceFloor(this)" unit="1">14楼</td>
		<td class="bgTd" onclick="choiceFloor(this)" unit="1">15楼</td>
		<td class="bgTd" onclick="choiceFloor(this)" unit="1">16楼</td>
		<td class="bgTd" onclick="choiceFloor(this)" unit="1">17楼</td>
		<td class="bgTd" onclick="choiceFloor(this)" unit="1">18楼</td>
		<td class="bgTd" onclick="choiceFloor(this)" unit="1">19楼</td>
		<td class="bgTd" onclick="choiceFloor(this)" unit="1">20楼</td>
		<td onclick="transverse(this)" type="0">选择行</td>
	</tr>
	<tr>
		<td class="bgTd" onclick="choiceFloor(this)" unit="1">11楼</td>
		<td class="bgTd" onclick="choiceFloor(this)" unit="1">12楼</td>
		<td class="bgTd" onclick="choiceFloor(this)" unit="1">13楼</td>
		<td class="bgTd"onclick="choiceFloor(this)" unit="1">14楼</td>
		<td class="bgTd" onclick="choiceFloor(this)" unit="1">15楼</td>
		<td class="bgTd" onclick="choiceFloor(this)" unit="1">16楼</td>
		<td class="bgTd" onclick="choiceFloor(this)" unit="1">17楼</td>
		<td class="bgTd" onclick="choiceFloor(this)" unit="1">18楼</td>
		<td class="bgTd" onclick="choiceFloor(this)" unit="1">19楼</td>
		<td class="bgTd" onclick="choiceFloor(this)" unit="1">20楼</td>
		<td onclick="transverse(this)" type="0">选择行</td>
	</tr>
	<tr>
		<td rowspan="3" onclick="choiceTitle(this)">五栋-1单元-选择栋</td>
		<td class="bgTd" onclick="choiceFloor(this)" unit="1">11楼</td>
		<td class="bgTd" onclick="choiceFloor(this)" unit="1">12楼</td>
		<td class="bgTd" onclick="choiceFloor(this)" unit="1">13楼</td>
		<td class="bgTd"onclick="choiceFloor(this)" unit="1">14楼</td>
		<td class="bgTd" onclick="choiceFloor(this)" unit="1">15楼</td>
		<td class="bgTd" onclick="choiceFloor(this)" unit="1">16楼</td>
		<td class="bgTd" onclick="choiceFloor(this)" unit="1">17楼</td>
		<td class="bgTd" onclick="choiceFloor(this)" unit="1">18楼</td>
		<td class="bgTd" onclick="choiceFloor(this)" unit="1">19楼</td>
		<td class="bgTd" onclick="choiceFloor(this)" unit="1">20楼</td>
		<td onclick="transverse(this)" type="0">选择行</td>
	</tr>
	<tr>
		<td class="bgTd" onclick="choiceFloor(this)" unit="1">11楼</td>
		<td class="bgTd" onclick="choiceFloor(this)" unit="1">12楼</td>
		<td class="bgTd" onclick="choiceFloor(this)" unit="1">13楼</td>
		<td class="bgTd"onclick="choiceFloor(this)" unit="1">14楼</td>
		<td class="bgTd" onclick="choiceFloor(this)" unit="1">15楼</td>
		<td class="bgTd" onclick="choiceFloor(this)" unit="1">16楼</td>
		<td class="bgTd" onclick="choiceFloor(this)" unit="1">17楼</td>
		<td class="bgTd" onclick="choiceFloor(this)" unit="1">18楼</td>
		<td class="bgTd" onclick="choiceFloor(this)" unit="1">19楼</td>
		<td class="bgTd" onclick="choiceFloor(this)" unit="1">20楼</td>
		<td onclick="transverse(this)" type="0">选择行</td>
	</tr>
	<tr>
		<td class="bgTd" onclick="choiceFloor(this)" unit="1">11楼</td>
		<td class="bgTd" onclick="choiceFloor(this)" unit="1">12楼</td>
		<td class="bgTd" onclick="choiceFloor(this)" unit="1">13楼</td>
		<td class="bgTd"onclick="choiceFloor(this)" unit="1">14楼</td>
		<td class="bgTd" onclick="choiceFloor(this)" unit="1">15楼</td>
		<td class="bgTd" onclick="choiceFloor(this)" unit="1">16楼</td>
		<td class="bgTd" onclick="choiceFloor(this)" unit="1">17楼</td>
		<td class="bgTd" onclick="choiceFloor(this)" unit="1">18楼</td>
		<td class="bgTd" onclick="choiceFloor(this)" unit="1">19楼</td>
		<td class="bgTd" onclick="choiceFloor(this)" unit="1">20楼</td>
		<td onclick="transverse(this)" type="0">选择行</td>
	</tr>
	<tr>
		<td rowspan="3" onclick="choiceTitle(this)">五栋-1单元-选择栋</td>
		<td class="bgTd" onclick="choiceFloor(this)" unit="1">11楼</td>
		<td class="bgTd" onclick="choiceFloor(this)" unit="1">12楼</td>
		<td class="bgTd" onclick="choiceFloor(this)" unit="1">13楼</td>
		<td class="bgTd"onclick="choiceFloor(this)" unit="1">14楼</td>
		<td class="bgTd" onclick="choiceFloor(this)" unit="1">15楼</td>
		<td class="bgTd" onclick="choiceFloor(this)" unit="1">16楼</td>
		<td class="bgTd" onclick="choiceFloor(this)" unit="1">17楼</td>
		<td class="bgTd" onclick="choiceFloor(this)" unit="1">18楼</td>
		<td class="bgTd" onclick="choiceFloor(this)" unit="1">19楼</td>
		<td class="bgTd" onclick="choiceFloor(this)" unit="1">20楼</td>
		<td onclick="transverse(this)" type="0">选择行</td>
	</tr>
	<tr>
		<td class="bgTd" onclick="choiceFloor(this)" unit="1">11楼</td>
		<td class="bgTd" onclick="choiceFloor(this)" unit="1">12楼</td>
		<td class="bgTd" onclick="choiceFloor(this)" unit="1">13楼</td>
		<td class="bgTd"onclick="choiceFloor(this)" unit="1">14楼</td>
		<td class="bgTd" onclick="choiceFloor(this)" unit="1">15楼</td>
		<td class="bgTd" onclick="choiceFloor(this)" unit="1">16楼</td>
		<td class="bgTd" onclick="choiceFloor(this)" unit="1">17楼</td>
		<td class="bgTd" onclick="choiceFloor(this)" unit="1">18楼</td>
		<td class="bgTd" onclick="choiceFloor(this)" unit="1">19楼</td>
		<td class="bgTd" onclick="choiceFloor(this)" unit="1">20楼</td>
		<td onclick="transverse(this)" type="0">选择行</td>
	</tr>
	<tr>
		<td class="bgTd" onclick="choiceFloor(this)" unit="1">11楼</td>
		<td class="bgTd" onclick="choiceFloor(this)" unit="1">12楼</td>
		<td class="bgTd" onclick="choiceFloor(this)" unit="1">13楼</td>
		<td class="bgTd"onclick="choiceFloor(this)" unit="1">14楼</td>
		<td class="bgTd" onclick="choiceFloor(this)" unit="1">15楼</td>
		<td class="bgTd" onclick="choiceFloor(this)" unit="1">16楼</td>
		<td class="bgTd" onclick="choiceFloor(this)" unit="1">17楼</td>
		<td class="bgTd" onclick="choiceFloor(this)" unit="1">18楼</td>
		<td class="bgTd" onclick="choiceFloor(this)" unit="1">19楼</td>
		<td class="bgTd" onclick="choiceFloor(this)" unit="1">20楼</td>
		<td onclick="transverse(this)" type="0">选择行</td>
	</tr>
</tboty>
</table>

页面的底部,设置好表格的选择事件控制的响应,代码如下:

<script type="text/javascript">
//================      控制点击单元全选的时候             ====================
function choiceTitle(obj){
	//声明参数b
	var b = "";
	//获取    rowspan  的值
	var foor = $(obj).attr("rowspan");
	//给当前的所有的参数  +1
	var index = $(obj).parent().index()+1;
	//循环最大不超过  rowspan 的值
	for(var i=0;i<foor;i++){
		//递加  +1   循环查找所有的td
		$(obj).parent().parent().find("tr:nth-child("+(index+i)+")").find(".bgTd").each(function(){
			//if判断
			if(!$(this).hasClass("bgs")){			//判断全选的时候,b==true
					b = false;						//取消全选
					return false;					//跳出当前循环
				}else{								//否则
					b = true;						//实现全选
				}
		});
		//判断b为真还是为假
		if(b){
			
		}else{
			//跳出  for  循环
			break;
		}
	}
	//循环查找所有的td
	for(var i=0;i<foor;i++){
		$(obj).parent().parent().find("tr:nth-child("+(index+i)+")").find(".bgTd").each(function(){
			if(b){										//判断全选的时候,b==true
				$(this).removeClass("bgs");			//取消全选
			}else{									//否则
				$(this).addClass("bgs");			//实现全选
			}
		})
	}
}
//================      控制点击单个的时候             ====================
function choiceFloor(obj){
	$(obj).toggleClass("bgs");						//控制单个的样式添加和删除
};
//================      控制点击横排全选的时候             ====================
function transverse(obj) {
	//声明参数
	var b = "";
	//查找当前父级标签下的所有的   bgtd
	$(obj).parents("tr").find(".bgTd").each(function(){
		if(!$(this).hasClass("bgs")){		//判断全选的时候,b==true
			b = false;						//取消全选
			return false;					//跳出当前循环
		}else{								//否则
			b = true;						//实现全选
		}
		
	});
	//查找父级标签下的所有的   bgTd
	$(obj).parents("tr").find(".bgTd").each(function(){
		if(b){									//判断全选的时候,b==true
			$(this).removeClass("bgs");			//取消全选
		}else{									//否则
			$(this).addClass("bgs");			//实现全选
		}
	});
	
}
</script>
相关内容推荐
资源求助发帖
查看更多发帖

*

回帖描述:

*

链接类型:

*

下载链接:

密码:
发帖规则:回帖内容为会员之间的私信,普通网友无法查看。
免责声明:回帖中提供的链接内容仅供会员之间学习参考使用,获取内容后请在法律法规范围内使用。回帖提供的内容应符合法律法规要求,不得违反法律法律的要求。
站点权责:回帖内容如违反法律法规,站点有权封停账号使用权利。对用户举报的内容,站点有责任及时删除违规内容。
热点内容推荐
标题:智能管理系统的楼层房屋位置选择代码

*

描述:
平均回复时间:3-10分钟
规则介绍:悬赏寻求论坛网友分享资源,站点对分享内容的准确性,合法性,版权等没有足够的监管能力。如果您发现资源不正确,无法使用,不符合法律法律等情况,您可以直接举报资源。站长将尽快核实您的举报,并根据情况,采取封号,退换米粒等处理。

*

回帖描述:

*

链接类型:

*

阅读权限:

*

下载链接:

密码:
发帖规则:回帖内容为会员之间的私信,普通网友无法查看。
免责声明:回帖中提供的链接内容仅供会员之间学习参考使用,获取内容后请在法律法规范围内使用。回帖提供的内容应符合法律法规要求,不得违反法律法律的要求。
站点权责:回帖内容如违反法律法规,站点有权封停账号使用权利。对用户举报的内容,站点有责任及时删除违规内容。
  • 背景波浪
  • 背景波浪
  • 波浪
  • 波浪
客服
在线咨询
周一 至 周日 9:00 ~ 22:00
QQ:1326974360
微信:juyoubuluo6688
客服热线
18205485173
工作日 9:00 ~ 18:00
微信扫码咨询
客户服务
欢迎咨询服务
咨询量较多时,请耐心等待
社群

关注公众号

获取更多资讯

扫码进群(QQ)

与更多大牛交流沟通

0.093564s