본문 바로가기

Programming/JavaScript

버튼클릭시 해당 행 삭제

<html>
    <head>
        <title> 버튼클릭시 해당행 삭제 </title>
<script language='javascript'>
<!--
 function rowDel(obj)
 {
     var tr = obj.parentNode.parentNode;
     tr.parentNode.removeChild(tr);
 }
//-->
</script>
    </head>
    <body>
<form name='form1' method='post'>
<table>
    <tr>
        <td>
            <input type="checkbox" id=" 1">
        </td>
        <td>
            <input type="button" id="1" value="1ROW" onclick='javascript:rowDel(this);'>
        </td>
    </tr>
    <tr>
        <td>
            <input type="checkbox" id=" 1">
        </td>
        <td>
            <input type="button" id="1" value="2ROW" onclick='javascript:rowDel(this);'>
        </td>
    </tr>
    <tr>
        <td>
            <input type="checkbox" id=" 1">
        </td>
        <td>
            <input type="button" id="1" value="3ROW" onclick='javascript:rowDel(this);'>
        </td>
    </tr>
</table>
</form>
    </body>
</html>