【问题标题】:does the tablesort jquery plugin work in google chrometablesort jquery 插件在谷歌浏览器中工作吗
【发布时间】:2013-04-07 15:38:13
【问题描述】:

有没有办法我可以添加一个 jquery tablesorter 插件,以便我使用 google chrome 浏览器对我的表进行排序,这是我在头文件中的代码

<script type="text/javascript" src="jquery/jquery/jquery-latest.js"></script> 
<script type="text/javascript" src="jquery/jquery/jquery.tablesorter.js"></script> 

<script type="text/javascript">

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

</script> 

echo "<table id='soop' border='1' cellpadding='10' >";

    echo " <thead> 
    <tr>
    <th>Id</th>
    <th>First Name</th>
    <th>Last Name</th>
    <th>Address</th>
    <th>Phone Number</th>
</tr> </thead>";

    echo "<tbody>";
    while($row = mysql_fetch_array( $result ))
    {

    echo " <tr>";
    echo '<td><b>' . $row['id'] . '</b></td>';
    echo '<td><b>' . $row['first_name'] . '</b></td>';
    echo '<td><b>' . $row['last_name'] . '</b></td>';
    echo '<td><b>' . $row['address'] . '</b></td>';
    echo '<td><b>' . $row['phone_number'] . '</b></td>';

    echo " </tr>";

    }
     echo "</tbody>";

有没有办法让 tablesort 插件在谷歌浏览器中工作,或者它只是我犯错误

【问题讨论】:

  • 它应该在 chrome 中工作。
  • 什么不起作用?你有错误吗?另外,我认为这并不重要,但您在上面的代码中缺少一个结束 &lt;/table&gt;

标签: jquery jquery-plugins tablesorter


【解决方案1】:

您需要为您的表格提供类名并包含插件中给出的样式表。

<script type="text/javascript" src="jquery/jquery-latest.js"></script> 
<script type="text/javascript" src="jquery/jquery.tablesorter.js"></script> 
<link rel="stylesheet" href="styles/style.css" type="text/css" />

<script type="text/javascript">

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

</script> 

<?php
echo "<table id='soop' class='tablesorter' border='1' cellpadding='10' >";

希望这会有所帮助...:)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-01-21
    • 1970-01-01
    • 2010-12-25
    • 1970-01-01
    • 1970-01-01
    • 2012-11-14
    • 2016-05-12
    相关资源
    最近更新 更多