<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<style>
.hide{
display: none;
}
.zhezhao{
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: black;
opacity: 0.6;
z-index: 9;
}
.add_mod{
height:400px;
width:500px;
position: fixed;
background-color: white;
left: 50%;
top: 50%;
margin-left: -250px;
margin-top: -200px;
z-index: 10;
}
</style>
</head>
<body style="margin: 0 auto;">
<input type="button" onclick="fun2()" value="添加" />
<input type="button" onclick="choise_all()" value="全选" />
<input type="button" onclick="cancel_all()" value="取消" />
<input type="button" onclick="reverse_all()" value="反选" />
<div>
<table border="1px">
<thead>
<tr>
<th>选择</th>
<th>IP</th>
<th>端口</th>
</tr>
</thead>
<tbody>
<tr>
<td><input type="checkbox"/></td>
<td>1.1.1.1</td>
<td>900</td>
</tr>
<tr id="tb">
<td><input type="checkbox"/></td>
<td>1.1.1.2</td>
<td>902</td>
</tr>
<tr>
<td><input type="checkbox"/></td>
<td>1.1.1.3</td>
<td>903</td>
</tr>
</tbody>
</table>
</div>
<!--遮罩层-->
<div id="i1" class="zhezhao hide"></div>
<!--模块弹窗开始-->
<div id="i2" class="add_mod hide">
<input type="text" />
<input type="text" />
<input type="button" onclick="fun1()" value="取消" />
<input type="button" value="确定" />
</div>
<!--模块弹窗结束-->
<script type="application/javascript">
function fun1() {
document.getElementById('i1').classList.add('hide');
document.getElementById('i2').classList.add('hide');
}
function fun2() {
document.getElementById('i1').classList.remove('hide');
document.getElementById('i2').classList.remove('hide');
}
function choise_all() {
var tr = document.getElementById('tb');
var trlist = tr.parentElement.children;
for (var i=0;i<trlist.length;i++) {
trlist[i].children[0].children[0].checked = true;
}
}
function cancel_all() {
var tr = document.getElementById('tb');
var trlist = tr.parentElement.children;
for (var i=0;i<trlist.length;i++) {
trlist[i].children[0].children[0].checked = false;
}
}
function reverse_all() {
var tr = document.getElementById('tb');
var trlist = tr.parentElement.children;
for (var i=0;i<trlist.length;i++) {
trlist[i].children[0].children[0].checked = ! trlist[i].children[0].children[0].checked;
// 以下是if判断写法
// if (trlist[i].children[0].children[0].checked) {
// trlist[i].children[0].children[0].checked = false;
// }else {
// trlist[i].children[0].children[0].checked = true;
// }
}
}
</script>
</body>
</html>

  

最新文章

  1. CSS之cursor属性
  2. goim socket丢包粘包问题解决。
  3. 《转》iOS音频视频初级开发
  4. Windows Phone 8.1 Update1 支持中文“小娜”及开发者模拟器更新
  5. php.curl详解
  6. OC7_单词个数
  7. 高动态范围光照(High Dynamic Range Imaging,简称HDRI或HDR)
  8. codeforces #309 div1 B
  9. Android(java)学习笔记164:Relativelayout相对布局案例
  10. perl 爬取上市公司业绩预告
  11. mac 上格式化磁盘出现MediaKit报告设备上的空间不足以执行请求的解决办法
  12. 在echarts里在geojson绘制的地图上展示散点图(气泡)、线集。
  13. 13.缓存、三级缓存、内存溢出、AsyncTask
  14. 轮廓(Outline) 实例
  15. centos7下安装nginx的方法
  16. docker-compose 在线安装升级
  17. ERROR 2002 (HY000): Can&#39;t connect to local MySQL server through socket &#39;/tmp/mysql/mysql.sock&#39; (2)
  18. github使用入门
  19. java 实现二分法
  20. Angular material mat-icon 资源参考_Connection

热门文章

  1. POJ 2001 Shortest Prefixes(字典树)
  2. 什么是PT,PT和BT有什么不同?
  3. 【leetcode】121-Best Time to Buy and Sell Stock
  4. [LeetCode&amp;Python] Problem 606. Construct String from Binary Tree
  5. ios开发常用封装的实用方法
  6. this语句的第三、四点
  7. linux----CenterOS7中在线安装jdk
  8. java中的Object类和其clone()
  9. What are long running processes?
  10. 初等数论及其应用 (第6版) (Kenneth H.Rosen 著)