123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- <!DOCTYPE html>
- <html lang="en">
- <script type="text/javascript" src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
- <head>
- </head>
- <body>
- <br>
-
- <table id="mt" border="1" cellpadding="5" cellspacing="0">
- <thead>
- <th>產品編號</th>
- <th>產品名稱</th>
- </thead>
- <tbody></tbody>
- <p><input type = "button" id="add" value = "新增" /></p>
- <p><input type = "button" id="del" value = "刪除" /></p>
- </table>
-
-
- <script type="text/javascript">
- var tag = 1;
-
- $(function(){
- $("#add").click(function(){
- $('#mt tbody').append('<tr><td>A0000'+tag+'</td><td><input type = "text"/></td></tr>');
- tag++;
- });
- $("#del").click(function(){
- $("#mt tbody tr:last").remove();
- });
-
- })
- </script>
- </body>
- </html>
|