首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

应用jquery的tablesorter插件进行表格排序

2013-03-10 
使用jquery的tablesorter插件进行表格排序tablesorter的官方网站: http://tablesorter.com/docs/使用方法:

使用jquery的tablesorter插件进行表格排序

tablesorter的官方网站: http://tablesorter.com/docs/

使用方法:

1.下载tablesorter http://tablesorter.com/__jquery.tablesorter.zip

2.解压文件,将jquery和jquery.tablesorter.min.js导入到项目文件中

3.修改html:

    1)添加链接

<script type="text/javascript" src='/pagemedia/js/jquery.tablesorter.min.js'></script><script type="text/javascript" src='/pagemedia/js/jquery.min.js'></script>


   2)修改表格

<table id="myTable"  class='tablesorter'>

为table添加id和class,class为tablesorter.(注意:table必须有thead和tbody)

   3)添加javascript脚本:

<script>$(document).ready(function(){     $("#myTable").tablesorter();      });</script>



ok!完成

热点排行