很抱歉带着这个愚蠢的问题来,但我已经挣扎了几个小时都没有成功。我的示例表没有被排序。这两个.js文件与.shtml文件本身位于相同的目录中。
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-us">
<head>
<script type="text/javascript" src="jquery-latest.js"></script>
<script type="text/javascript" src="jquery.tablesorter.js"></script>
<script type="text/javascript">
$(document).ready(function()
{
$("#myTable").tablesorter();
}
);
</script>
</head>
<body>
<table id="myTable" class="tablesorter">
<thead>
<tr>
<th>Test1</th>
<th>Test2</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>1622</td>
</tr>
<tr>
<td>2</td>
<td>2634</td>
</tr>
</tbody>
</table>
</body>
</html>发布于 2013-03-24 10:05:48
也许你有jquery和tablesorter的坏拷贝?对于我来说,使用jquery和tablesorter的实际版本从各自的站点链接起来似乎都很好。
http://code.jquery.com/jquery-1.9.1.js
http://mottie.github.com/tablesorter/js/jquery.tablesorter.js
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-us">
<head>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script type="text/javascript" src="http://mottie.github.com/tablesorter/js/jquery.tablesorter.js"></script>
<script type="text/javascript">
$(document).ready(function()
{
$("#myTable").tablesorter();
}
);
</script>
</head>
<body>
<table id="myTable" class="tablesorter">
<thead>
<tr>
<th>Test1</th>
<th>Test2</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>1622</td>
</tr>
<tr>
<td>2</td>
<td>2634</td>
</tr>
</tbody>
</table>
</body>https://stackoverflow.com/questions/15594251
复制相似问题