增删改查——————增

<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- 上述3个meta标签*必须*放在最前面,任何其他内容都*必须*跟随其后! -->
<title>学员管理界面</title>
<!-- Bootstrap -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="css/normalize.css">
<link rel="stylesheet" href="学员管理.css"/>

</head>
<body>
<div class="carousel">
<div class="row">
<div class="col-xs-8 col-xs-push-2">
<a href="登陆.html">登陆</a>
<a href="注册.html">注册</a>
</div>
</div>
<div class="row">
<div class="col-xs-2 col-xs-push-5">
<h1>学员管理</h1>
</div>
</div>
<div class="row">
<div class="col-xs-10 col-xs-push-1" style="text-align: center">
<table class="table table-striped table-bordered">
<tr>
<th>姓名</th>
<th>年龄</th>
<th>性别</th>
<th></th>
</tr>
<tbody id="tbody">

</tbody>
</table>
</div>
</div>
<div class="col-xs-8 col-xs-push-2" id="xiugai">
<input type="hidden" name="id1"/>
姓名:<input type="text"/>
年龄:<input type="text"/>
性别:<input type="text"/>
<input type="button" value="修改"/>
</div>
<div class="col-xs-8 col-xs-push-2" style="margin-top: 50px">
姓名:<input type="text" id="name"/>
年龄:<input type="text" id="age"/>
性别:<input type="radio" name="1" value="男"/>男
<input type="radio" name="1" value="女"/>女
<input type="button" value="增加"/>
</div>
</div>

<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->

<script src="js/jquery-1.11.2-min.js"></script>
<script type="text/javascript" src="js/common.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="js/bootstrap.min.js"></script>
<script type="text/javascript">

$(function(){
// 增加学员列表
$(":button[value=增加]").click(function(){

var students=get("students");
if(!students){
students=[]
}
students.push({
name1:$("#name").val(),
age1:$("#age").val(),
sex:$(":radio[name=1]:checked").val(),
id:generateId("students")
});
save("students",students);
var studentsa="";
$(students).each(function(){
studentsa += "<tr>"
+ "<td>" + this.name1 + "</td>"
+ "<td>" + this.age1+ "</td>"
+ "<td>" + this.sex + "</td>"
+ "<td>"
+ "<input student-id='" + this.id + "' type=\"button\" value=\"修改1\">"
+ "<input student-id='" + this.id + "'type=\"button\" value=\"删除\">"
+ "</td>"
+ "</tr>";
});
$("#tbody").html(studentsa);
});
</script>
</body>
</html>

转载于:https://www.cnblogs.com/q1748486819/p/5562590.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值