一个Javascript 的类库,用于table内容排序。使用很方便,不用每次都去调用数据库了。
特别适合多表查询的排序。加上<tbody>的style.display 切换,也可以实现分页。
用法:
1.添加JS
<SCRIPT src=
"sorttable.js" type=
"text/javascript"></SCRIPT>
2.添加TABLE,注意的是:一定要有ID,class为"sortable"
<table
class=
"sortable" id=
"mytable">
OK,可以了,简单的吧
如果觉得太单调,自己加点CSS吧,官方给出了改HEAD的CSS
/* Sortable tables */
table .sortable a .sortheader {
background-color:#eee;
color:# 666666;
font-weight: bold;
text-decoration: none;
display: block;
}
table .sortable span .sortarrow {
color: black;
text-decoration: none;
}
table .sortable a .sortheader {
background-color:#eee;
color:# 666666;
font-weight: bold;
text-decoration: none;
display: block;
}
table .sortable span .sortarrow {
color: black;
text-decoration: none;
}