2016-06-09 39 views
-3

這是我的HTML頁面:我不能讓jQuery的表分揀工作

<!DOCTYPE html> 
<html> 
    <head> 
     <title>Page Title</title> 
     <script src="http://tablesorter.com/jquery-latest.js" type="text/javascript"/> 
     <script src="http://tablesorter.com/jquery.tablesorter.js" type="text/javascript"/> 
     <script type="text/javascript">$(document).ready(function() { 
      $("#myTable").tablesorter({sortList: [[0, 0]]}); 
     }); 
    </script> 
    </head> 
    <body> 
     <h1>Repid Type Table</h1> 
     <table class="tablesorter" id="myTable"> 
      <tr> 
       <th>PERNR</th> 
       <th>INNBOUND</th> 
       <th>FIRSTNAME</th> 
       <th>LASTNAME</th> 
       <th>CATSHOURS</th> 
       <th>DIFF</th> 
      </tr> 
      <tr> 
       <td>00017808</td> 
       <td>26.50</td> 
       <td>Roland</td> 
       <td>Block</td> 
       <td>1830.70</td> 
       <td>1804.20</td> 
      </tr> 
      <tr> 
       <td>123412</td> 
       <td>111.34</td> 
       <td>Koray</td> 
       <td>Tugay</td> 
       <td>945.56</td> 
       <td>234.43</td> 
      </tr> 
     </table> 
    </body> 
</html> 

但是我看到表似乎並不有功能的。我錯過了什麼?

+0

可能重複[爲什麼不能自我關閉腳本標記工作?](http://stackoverflow.com/questions/69913/why-dont-self-closing-script-tags-work) – Xufox

回答

5

我想你錯過了關閉</script>標記爲您 「包括」:

<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> 

更新

修復的源路徑。也可能考慮使用一些CDN來加載你的JavaScript庫。例如https://cdnjs.cloudflare.com/ajax/libs/jquery.tablesorter/2.26.2/js/jquery.tablesorter.min.js

+0

另外http://tablesorter.com/jquery.tablesorter.js投擲404. –

+1

不應該依靠該網站作爲CDN。可以從衆多適當的CDN獲得 – charlietfl

+0

謝謝你的回答。我已將其更改爲: 仍然無法正常工作... –