休息
http://white-x.top/watersortpuzzle/
水排序小游戏
补表单添加
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110
| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Untitled Document</title> <link rel="stylesheet" type="text/css" href="styleB/css.css" /> <script type="text/javascript" src="../../script/jquery-1.7.2.js"></script> <script type="text/javascript"> $(function(){ //删除用户的方法 function delA(){ //获取要删除员工的名字 var name = $(this).parents("tr").find("td:eq(0)").text();//取父元素 //弹出一个确认框 var flag = confirm("确认删除"+name+"吗?"); if(flag){ //删除当前a所在的tr $(this).parents("tr").remove(); } //取消默认行为 return false; } //删除用户 //$("a").click(delA); $("a").live("click" , delA); //添加员工 $("#addEmpButton").click(function(){ //获取用户填写的内容 var name = $("#empName").val(); var email = $("#email").val(); var salary = $("#salary").val(); //创建tr /* <tr> <td>Tom</td> <td>tom@tom.com</td> <td>5000</td> <td><a href="#">Delete</a></td> </tr> */ $("<tr></tr>").append("<td>"+name+"</td>") .append("<td>"+email+"</td>") .append("<td>"+salary+"</td>") .append("<td><a href='#'>Delete</a></td>") .appendTo("#employeeTable"); }); }); </script> </head> <body> <table id="employeeTable"> <tr> <th>Name</th> <th>Email</th> <th>Salary</th> <th> </th> </tr> <tr> <td>Tom</td> <td>tom@tom.com</td> <td>5000</td> <td><a href="#">Delete</a></td> </tr> <tr> <td>Jerry</td> <td>jerry@sohu.com</td> <td>8000</td> <td><a href="#">Delete</a></td> </tr> <tr> <td>Bob</td> <td>bob@tom.com</td> <td>10000</td> <td><a href="#">Delete</a></td> </tr> </table> <div id="formDiv"> <h4>添加新员工</h4> <table> <tr> <td class="word">name: </td> <td class="inp"> <input type="text" name="empName" id="empName" /> </td> </tr> <tr> <td class="word">email: </td> <td class="inp"> <input type="text" name="email" id="email" /> </td> </tr> <tr> <td class="word">salary: </td> <td class="inp"> <input type="text" name="salary" id="salary" /> </td> </tr> <tr> <td colspan="2" align="center"> <button id="addEmpButton" value="abc"> Submit </button> </td> </tr> </table> </div> </body> </html>
|