HOME       LIST

【Javascript】Table の Tr をMoveする。

Table の Tr をMoveする。


<html>
<body>
<script type="text/javascript">
<!--
function function1() {
	var oTable;
	var rowCnt;

	oTable = document.all.myTable;
	rowCnt = oTable.rows.length;
	oTable.moveRow(0, rowCnt - 1);
}
//-->
</script>
<table id="myTable" border="1" cellspacing="5" cellpadding="5">
    <tr bgcolor="#FF3535">
        <td width="200">1</td>
    </tr>
    <tr bgcolor="#FFCD35">
        <td>2</td>
    </tr>
    <tr bgcolor="#E6FF35">
        <td>3</td>
    </tr>
    <tr bgcolor="#81FF35">
        <td>4</td>
    </tr>
</table>
<button onclick="function1();">Move Row</button>
</body>
</html>

以前コンテンツ:【Javascript】この文書のパスは?
次のコンテンツ:【Javascript】Visual BasicのTrim()関数を具現する。



Copyright(c) 2007-2024 dojeun.com All Rights Reserved.

Valid XHTML 1.0 Transitional