jquery基础
来源:互联网 发布:软件工程硕士全日制 编辑:程序博客网 时间:2024/06/07 02:59
<html>
<head>
<script type="text/javascript" src="js/jquery-3.2.1.js"></script>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
序号:<input type="text" id="xh" /><br/>
姓名:<input type="text" id="xm" /><br/>
学号:<input type="text" id="xhh" /><br/>
年龄:<input type="text" id="nl" /><br/>
<button type="button" id="add">添加</button>
<button type="button" id="del">删除</button>
<table id="a" border="1" cellspacing="0">
<tr>
<td><input type="checkbox" id="zxh"></td>
<td>序号</td>
<td>姓名</td>
<td>学号</td>
<td>年龄</td>
</tr>
</table>
<script type="text/javascript">
$("#add").click(function(){
var xh = $("#xh").val();
var xm = $("#xm").val();
var xhh = $("#xhh").val();
var nl = $("#nl").val();
var newTr = "<tr><td><input type='checkbox' class='ls'></td><td>"+xh+"</td><td>"+xm+"</td><td>"+xhh+"</td><td>"+nl+"</td></tr>";
var table = $("#a");
table.append(newTr);
});
$("#zxh").click(function(){
if($(this).prop("checked") == true){
$(".ls").prop("checked",true);
}else{
$(".ls").prop("checked",false);
}
});
$("#del").click(function(){
var xz = $(".ls:checked");
xz.each(function(index,elem){;
var $_elem = $(elem)
var $_tr = $_elem.parent().parent();
$_tr.remove();
})
});
</script>
</body>
</html>
<head>
<script type="text/javascript" src="js/jquery-3.2.1.js"></script>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
序号:<input type="text" id="xh" /><br/>
姓名:<input type="text" id="xm" /><br/>
学号:<input type="text" id="xhh" /><br/>
年龄:<input type="text" id="nl" /><br/>
<button type="button" id="add">添加</button>
<button type="button" id="del">删除</button>
<table id="a" border="1" cellspacing="0">
<tr>
<td><input type="checkbox" id="zxh"></td>
<td>序号</td>
<td>姓名</td>
<td>学号</td>
<td>年龄</td>
</tr>
</table>
<script type="text/javascript">
$("#add").click(function(){
var xh = $("#xh").val();
var xm = $("#xm").val();
var xhh = $("#xhh").val();
var nl = $("#nl").val();
var newTr = "<tr><td><input type='checkbox' class='ls'></td><td>"+xh+"</td><td>"+xm+"</td><td>"+xhh+"</td><td>"+nl+"</td></tr>";
var table = $("#a");
table.append(newTr);
});
$("#zxh").click(function(){
if($(this).prop("checked") == true){
$(".ls").prop("checked",true);
}else{
$(".ls").prop("checked",false);
}
});
$("#del").click(function(){
var xz = $(".ls:checked");
xz.each(function(index,elem){;
var $_elem = $(elem)
var $_tr = $_elem.parent().parent();
$_tr.remove();
})
});
</script>
</body>
</html>
阅读全文
0 0
- JQuery基础
- jquery基础
- jquery基础
- jQuery基础
- jquery基础
- jquery基础
- jquery 基础
- jquery基础
- jQuery基础
- jquery 基础
- Jquery 基础
- jquery基础
- jquery基础
- jQuery基础
- jquery基础
- jquery基础
- jquery 基础
- jquery基础
- 1047. 编程团体赛(20)
- 用webservice发布自己的天气预报服务
- Java-NIO(二):缓冲区(Buffer)的数据存取
- 链表插入
- Python 测试api访问时间并发送给指定微信好友
- jquery基础
- centos jdk安装配置(备忘)
- 西安科技大学电力电子技术2017年期中考试试卷
- idea工具中项目启动多个实例步骤
- 如何既快速又优雅的写博客:Typora + MPic
- Creator 添加触摸,鼠标,键盘事件方法
- DynaCal标定
- MFC获取主对话框指针的方式
- java中volatile、synchronized和lock解析