moveRow method
Moves a table row to a new position.
Syntax
object.moveRow(indexFrom, indexTo)Parameters
- indexFrom [in]
-
Type: Integer
Integer that specifies the index in the rows collection of the table row that is moved.
- indexTo [in]
-
Type: Integer
Integer that specifies where the row is moved within the rows collection.
Return value
Type: Object
Object. Returns a reference to the table row that is moved.
Standards information
There are no standards that apply here.
Remarks
Rows between the indexFrom and indexTo positions in the rows collection are shifted based on the direction the row moves.
Examples
This example uses the moveRow method to exchange the first and second rows in a table when the user clicks a button.
<script type="text/javascript"> function fnMove(){ oTable.moveRow(0,1); } </script> <input onclick="fnMove()" type="button" value="Change Rows"> <table id="oTable"> <tr> <td>Cell 1, Row 1</td> </tr> <tr> <td>Cell 1, Row 2</td> </tr> </table>
See also
Show: