This article shares the complete order operation applet (add orders, delete orders, and modify order quantity) for your reference. The specific content is as follows
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> <style> table { text-align: center; } </style> <script> function delRow(id) { //Get the line to be deleted var row = (id);//Follow the id to find the line var table = ('mytb'); ();//Delete the content of a certain line according to the index of the line } function addrow() { var mytb = ('mytb'); var index = - 1;//Get the insert target index, a certain line var row = (index);//Insert the line to a certain position, insert a line var id = 'row' + ;//Split id ('id', id);//Set id var td0 = (0);//td0 creates a cell = "Good-looking, durable, super wear-resistant sofa two-piece set";//Set the content of td0 var td1 = (1); = ;// Assign the index of the line to the content of td1 var td2 = (2);//Insert td2 into a cell = '<input type="button" value="delete" onclick="delRow(\'' + id + '\')">' + '<input type="button" value="Revise" onclick="update(\'' + id + '\')">'; } function update(id) { var row = (id); var td1 = [1]; var v = ; = '<input type="text" style="width:30px" value="' + v + '">'; [2].innerHTML = '<input type="button" value="delete" onclick="delRow(\'' + id + '\')">' + '<input type="button" value="Sure" onclick="comfirmrow(\'' + id + '\')">'; } function comfirmrow(id) { var row=(id); var td1=[1];//Get the second cell of each row var input=;//Get input tag var v=;//Get input content =v;// Assign content to td1 var td2=[2]; = '<input type="button" value="delete" onclick="delRow(\'' + id + '\')">' + '<input type="button" value="Revise" onclick="update(\'' + id + '\')">'; } </script> </head> <body> <table border="1" cellspacing="0" cellpadding="0" > <tr> <td>Product Name</td> <td>quantity</td> <td>operate</td> </tr> <tr > <td>Good-looking, durable, super wear-resistant sofa two-piece set</td> <td>24</td> <td><input type="button" value="delete" onclick="delRow('del1')"><input type="button" value="Revise"></td> </tr> <tr> <td colspan="3"><input type="button" value="Add orders" onclick="addrow()"></td> </tr> </table> </body> </html>
The above is all the content of this article. I hope it will be helpful to everyone's study and I hope everyone will support me more.