2016-05-21 4 views
0

これは非常に簡単な場合、最初の私はHTMLの男だから謝罪していません。 昨晩共有ホスティングを購入し、自分のウェブページにhtmlテーブルを表示したいと考えています。 また、htmlテーブルをソートする機能も必要です。私はいくつかのグーグルをして、テーブルウェアが行く良い方法だと分かった。 私はそれがテーブルとテーブルを使ったhtmlテーブルとjquery

<script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script> 
<script type="text/javascript" src="C:\Users\xx\Desktop\pages\jquery.tablesorter.js"></script> 
<table id="myTable" class="tablesorter"> 
<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> 
$(document).ready(function() 
    { 
     $("#myTable").tablesorter(); 
    } 
); 


$(document).ready(function() 
    { 
     $("#myTable").tablesorter({sortList: [[0,0], [1,0]]}); 
    } 
); 

である。しかし、それが生成する出力は

enter image description here

私はここで間違って何をやっています

+0

場所 '$(ドキュメント).readyであるここに私のコードを入れて(function()) { $( "#myTable"); tablesorter(); } ); $(ドキュメント).ready(関数(){ $( "#MYTABLE")tablesorter({sortlistが:[0,0]、[1,0]});} )。 'これらのスクリプトタグ – guradio

+0

でも、私は' 'のような何らかの理由で動作しませんそれはあなたのデスクトップではなく、あなたのホスティングを参照しているのを見て... –

+0

@guradioあなたはスクリプトタグの意味ですか?今すぐデスクトップ上の共有ホスティングに入れようとしています。 – nnnnmmm

答えて

1
This is corrected html for tablesorter 

<script type="text/javascript" src="https://code.jquery.com/jquery-2.2.4.min.js"></script> 
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery.tablesorter/2.26.1/js/jquery.tablesorter.js"></script> 
<script> 
    $(document).ready(function() { 
     $("table").tablesorter(); 
     $("#trigger-link").click(function() { 
      var sorting = [[0, 0], [2, 0]]; 
      $("table").trigger("sorton", [sorting]); 
      return false; 
     }); 
    }); 
</script> 
<table id="myTable" class="tablesorter"> 
    <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>`enter code here` 
関連する問題