小编Bhu*_*tel的帖子

单击添加表行按钮

我想要点击按钮时新行。

<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>插入到现有表中。

html javascript jquery

1
推荐指数
1
解决办法
2万
查看次数

标签 统计

html ×1

javascript ×1

jquery ×1