2013-04-15 20 views
0

是有办法,我可以添加一个jQuery tablesorter插件让我有点使用谷歌Chrome浏览我的表这是我在头文件并在谷歌Chrome tablesort jQuery插件工作

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

代码有一种使Google桌面插件工作在谷歌浏览器或其只是我犯了错误的方式

+0

应该在Chrome浏览器。 –

+0

什么不起作用?你有错误吗?另外,我不认为这很重要,但是你错过了上面代码中的结尾''。 – Mottie

回答

-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' >"; 

希望这将帮助... :)