【1】这个非常好用,
<head>
<script type="text/javascript" src="sortabletable.js"></script>
<link type="text/css" rel="StyleSheet" href="sortabletable.css" />
</head>
在<head></head>之间加入
【2】<table class="sort-table" id="table-1" cellspacing="0">
要排序的表中要加入 id="table-1"
【3】<thead>
<tr>
<td>String</td>
<td title="CaseInsensitiveString">String</td>
<td>Number</td>
<td>Date</td>
<td>No Sort</td>
</tr>
</thead>
点击的表头之间加入<thead></thead>
剩下的之间加入<tbody></tbody>
<tbody>
<tr>
<td>apple</td>
<td>Strawberry</td>
<td>45</td>
<td>2001-03-13</td>
<td>Item 0</td>
</tr>
<tr>
<td>Banana</td>
<td>orange</td>
<td>7698</td>
<td>1789-07-14</td>
<td>Item 1</td>
</tr>
<tr>
<td>orange</td>
<td>Banana</td>
<td>4546</td>
<td>1949-07-04</td>
<td>Item 2</td>
</tr>
</tbody>
【4】
</table>
<script type="text/javascript">
var st1 = new SortableTable(document.getElementById("table-1"),
["String", "CaseInsensitiveString", "Number", "Date", "None"]);