redskin Posted December 22, 2008 Share Posted December 22, 2008 Hallo, someone has made this script for me, because i do not know about it. Its work fine. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>Online membership</title> <link href="main.css" type="text/css" rel="stylesheet"> </head> <script> function add_formrow(){ if (!this.table_formcontainer) this.table_formcontainer = document.getElementById("table_formcontainer"); if (!this.table_formcontainer) return; var new_row = table_formcontainer.insertRow(-1); var new_cell1 = new_row.insertCell(0); var new_cell2 = new_row.insertCell(1); var new_cell3 = new_row.insertCell(2); var new_input1 = document.createElement("input"); new_input1.type = "text"; new_cell1.appendChild(new_input1); var new_input2 = document.createElement("input"); new_input2.type = "text"; new_cell2.appendChild(new_input2); var new_input3 = document.createElement("select"); new_input3.name="transport[]"; var options = ["No", "Bike", "Car", "Motorbike", "Public transport"]; for (var i = 0; i < options.length; i++) { var option = document.createElement("option"); option.value = options[i]; option.text= options[i]; try { new_input3.add(option, null); } catch(error) { new_input3.add(option); } } new_cell3.appendChild(new_input3); } </script> <body> <div id="credit"><b>T e s t</b></div> <br> <form method="post" action="" name="data"> <fieldset> <legend> <font color="blue"><b>Request</b></font></legend><br> <table id="table_formcontainer"> <tr> <td width="10">Name</td> <td>Age<td>Transport<td> </td> </td> </tr> </table> <table> <tr> <td width="500" align="right">[ b<a href="#" onclick='add_formrow();'>+</a> ]</td> </tr> <tr> <td width="10"><br><input type="submit" name="submit" value=" S e n d "> <td> </td> <td> </td> <td> </td></td> </tr> </table> </form></fieldset> <br> </body> </html> I just wonder how to make one more button to create kind of deleterow. thanks in advance. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.