JavaScript Reference/Javascript Methods/moveRow

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

"moveRow()" 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>



"moveRow()" is applied to

+----------------+--------------------------------------------------------------+
| Applied_To     |<table>                         <tbody>                       |
|                |<tfoot>                         <thead>                       |
+----------------+--------------------------------------------------------------+



"moveRow()" Syntax, Parameters and Note

Note:
Moves row to a new position.
    
Syntax:
    
document.all.elementID.moveRow(param1, param2)
Parameters:
    param1   Required; the index of the row to move.
    param2   Required; the index of the new position.