JavaScript Reference/Javascript Methods/deleteCell

Материал из Web эксперт
Перейти к: навигация, поиск

"deleteCell()" Example

    
<html>
<body>
<script language="JavaScript">
    function function1() {
        document.all.myTable.deleteCell(2);
    }
</script>
<table>
    <tr id="myTable">
        <td>Cell 1</td>
        <td>Cell 2</td>
        <td>Cell 3</td>
        <td>Cell 4</td>
    </tr>
</table>
<input type="button" value="Remove Cell" onclick="function1();">
</body>
</html>



"deleteCell()" is applied to

+----------------+--------------------------------------------------------------+
| Applied_To     |<tr>                                                          |
+----------------+--------------------------------------------------------------+



"deleteCell()" Syntax, Parameters and Note

Note:
This method removes a cell from a table row.
    
Syntax:
    
document.getElementById("trID").deleteCell(param1) 
document.all.trID.deleteCell(param1) // IE only

Parameters:
    param1   Optional; the cell index in the row. 
             If omitted, the last cell in the row will be removed.