2013-04-15 19 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' >"; 

希望這將幫助... :)