我正在尝试使用表排序器对表进行排序,但是它不起作用
<html>
<head>
<link rel="stylesheet" href="blueStyle.css" type="text/css" media="print, projection, screen" />
<script src="http://tablesorter.com/jquery-latest.js" type="text/javascript"></script>
<script src="http://tablesorter.com/__jquery.tablesorter.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function() {
$("#myTable").tablesorter();
});
</script>
</head>
<body>
<table id="myTable" class="tablesorter" border="0" cellpadding="0" cellspacing="1">
<thead>
<tr>
<th>Last Name</th>
<th>First Name</th>
<th>Email</th>
<th>Due</th>
<th>Web Site</th>
</tr>
</thead>
<tbody>
<tr>
<td>Smith</td>
<td>John</td>
<td>[email protected]</td>
<td>$50.00</td>
<td>http://www.jsmith.com</td>
</tr>
<tr>
<td>Bach</td>
<td>Frank</td>
<td>[email protected]</td>
<td>$50.00</td>
<td>http://www.frank.com</td>
</tr>
<tr>
<td>Doe</td>
<td>Jason</td>
<td>[email protected]</td>
<td>$100.00</td>
<td>http://www.jdoe.com</td>
</tr>
<tr>
<td>Conway</td>
<td>Tim</td>
<td>[email protected]</td>
<td>$50.00</td>
<td>http://www.timconway.com</td>
</tr>
</tbody>
</table>
</body>
</html>
样式似乎有效,但没有排序。
这是表格目前的样子。
您忘记关闭脚本标签</script>
:
<script src="http://tablesorter.com/__jquery.tablesorter.min.js" type="text/javascript"/>
正确的标记:
<script src="http://tablesorter.com/__jquery.tablesorter.min.js" type="text/javascript"/></script>
我复制了您的代码,添加了</script>
它,并且对我有用。同样来自http://tablesorter.com/jquery-latest.js的jquery文件确实已经过时(2008年),请考虑使用其他CDN,例如//code.jquery.com/jquery-1.10.2.min.js或googleapis
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句