Title
table,td,th{
border: 1px solid slateblue ;
}
div{
vertical-align: center;
text-align: center;
}
$(function (){
var $delete=function (){
var $parent = $(this).parent().parent();
var name = $parent.find("td:first").text();
if(confirm("是否删除"+name)){
$parent.remove();
}
return false;
}
$("#addEmpButton").click(function (){
var username = $("#username").val();
var email = $("#useremaril").val();
var salary = $(":text[name='usersalary']").val();
//创建一个行标签对象
var $q1 = $("<tr>\n" +
" <td>"+username+"</td>\n" +
" <td>"+email+"</td>\n" +
" <td>"+salary+"</td>\n" +
" <td><a href=\"deleteEmp?id=001\">Delete</a></td>\n" +
" </tr>");
$q1.appendTo($("#employeeTable"));
$q1.find("a").click($delete);
});
$("a").click($delete);
});
name
email
salary
caozuo
await
await@qq.com
10000
Delete
添加员工
name:
email:
salary
提交
本文共 21 个字数,平均阅读时长 ≈ 1分钟