Move a Row Example : Row « Table « JavaScript DHTML





Move a Row Example

    
<html>
<body>
<script language="JavaScript">
function function1() {
    document.all.myTable.moveRow(-1, 2);
}
</script>
<table id="myTable" border="1" cellspacing="5" cellpadding="5">
    <tr>
        <td>First Row</td>
        <td>&nbsp;</td>
    </tr>
    <tr>
        <td>Second Row</td>
        <td>&nbsp;</td>
    </tr>
    <tr>
        <td style="background-color:blue">Third Row</td>
        <td>&nbsp;</td>
    </tr>
    <tr>
        <td style="background-color:red">Fourth Row</td>
        <td>&nbsp;</td>
    </tr>
</table>
<button onclick="function1();">Move Row</button>
</body>
</html>

    
      
      










Related examples in the same category

1.Table row Index
2.Table section Row Index
3.Delete Row
4.Insert a Row Example
5.'rowSpan' Example