怎么让两个TR可以颠倒位置

我想用button控制TR的位置,可以调整几个TR互相调换位置!!怎么实现??
---------------------------------------------------------------

http://lucky.myrice.com/javascriptexam/sortRow.htm
---------------------------------------------------------------

 1<table border="1" id="s" width="100">
 2<tr>
 3<td width="50%">1</td>
 4<td width="50%">2</td>
 5</tr>
 6<tr>
 7<td width="50%">3</td>
 8<td width="50%">5</td>
 9</tr>
10<tr>
11<td width="50%">6</td>
12<td width="50%">7</td>
13</tr>
14</table>
1<input onclick="s.insertRow(0).replaceNode(s.rows[s.rows.length-1])" type="button" value="Down"/>
1<input onclick="s.insertRow(s.rows.length).replaceNode(s.rows[0])" type="button" value=" Up "/>

---------------------------------------------------------------

 1<table>
 2<tr><td>
 3<table border="1" id="tb1">
 4<tr><td>aaa</td></tr>
 5<tr><td>aaa</td></tr>
 6</table>
 7</td></tr>
 8<tr><td>
 9<table border="1" id="tb2">
10<tr><td>bbb</td></tr>
11<tr><td>bbb</td></tr>
12</table>
13</td></tr>
14</table>
1<input onclick="fnSwap()" type="button" value="Swap List"/>
1<script>   
2function fnSwap(){   
3tb1.swapNode(tb2);   
4}   
5</script>
Published At
Categories with Web编程
Tagged with
comments powered by Disqus