3
function moveRow(from, to)
5
if (from == -1 && to == -1)
7
var fromE = document.getElementsByTagName("INPUT")[0];
8
from = parseInt(fromE.value);
9
var toE = document.getElementsByTagName("INPUT")[1];
10
to = parseInt(toE.value);
12
var row = document.getElementsByTagName("TR")[from];
17
// Test fails if final ordering differs from initial ordering
19
// Starting with order 0,1,2,3,4,5 shift through the rows and
20
// end up back where we started.
28
// Throw 2 out-of-bounds tests at the end and still get back to the starting point.
34
setTimeout("runTests()", 9);
37
<body bgcolor=white onload="delay()">
39
<tr><td>Row 0</td></tr>
40
<tr><td>Row 1</td></tr>
41
<tr><td>Row 2</td></tr>
42
<tr><td>Row 3</td></tr>
43
<tr><td>Row 4</td></tr>
44
<tr><td>Row 5</td></tr>
46
<input type=text name=from value=2 size=1>
47
<input type=text name=to value=4 size=1>
48
<input type=button name=go value=go onclick="moveRow(-1,-1);">