我想要点击按钮时新行。
<html>
<table id="tbl">
<tr>
<td><input type="text" name="links" /></td>
<td><input type="text" name="keywords" /></td>
<td><input type="text" name="violationtype" /></td>
<td><input type="button" value="Delete Row" onclick="SomeDeleteRowFunction(this)"/></td>
</tr>
</table>
<input type="submit" class="button" value="Add another line" onclick="addField(this);" />
</html>
Run Code Online (Sandbox Code Playgroud)
javascript:
window.SomeDeleteRowFunction = function SomeDeleteRowFunction(o) {
var p=o.parentNode.parentNode;
p.parentNode.removeChild(p);
}
Run Code Online (Sandbox Code Playgroud)
当我第一次单击“提交”按钮时,整个表都会被插入,之后我第二次单击“提交”按钮只会<tr>插入到现有表中。