0

我在使用 tablesorter 时遇到问题。我将脚本添加到文档的头部,并确保更改表的 ID,但它不会让我排序。

表代码:

<table class="table tablesort" id="table1">
    <thead>  
      <tr>  
        <th>Summoner Name</th>     
        <th>Role</th>  
        <th>Type</th>  
        <th>Level</th>
        <th>Division</th>
        <th>Comment</th>
        <th>Posted</th>  
      </tr>
    </thead>  
    <tbody>  
      <?php
        $result = mysql_query("SELECT * FROM na");
        $time = floor((time()-'time') / 60);
        mysql_query("DELETE FROM na WHERE " . -'time'+time()>3600);
        while($row = mysql_fetch_array($result))
        {
        if($_SERVER['REMOTE_ADDR']==$row['ip']){
            echo "<script type='text/javascript'>
            $('#buttonop').attr('value', 'Delete Your Listing');
            $('#buttonopa').attr('href', 'delete.php');
            $('#buttonop').removeClass('btn btn-large btn-success').addClass('btnchange');
            </script>";
        }
        $time = floor((time()-$row['time']) / 60);
        {
        echo "<tr>";
        echo "<td>" . $row['summoner'] . "</td>";
        echo "<td>" . $row['role'] . "</td>";
        echo "<td>" . $row['type'] . "</td>";
        echo "<td>" . $row['level'] . "</td>";
        echo "<td>" . $row['division'] . "</td>";
        echo "<td style='width: 350px;'>" . $row['comment'] . "</td>";
        echo "<td>" . $time . " minute(s) ago </td>";
        echo "</tr>";
        }
        }
      ?>
    </tbody>  
</table>

分拣机代码:

$(document).ready(function() 
    { 
        $("#table1").tablesorter(); 
    } 
); 
4

1 回答 1

2

您在粘贴的第一行将类命名为“tablesort”而不是“tablesorter”。尝试将其更改为“tablesorter”,看看是否有效。

于 2013-03-05T01:56:10.507 回答