-1
我在php中創建了一個包含客戶信息行的表格,其中包含有關每個客戶的註釋。在jquery中切換表格echod的顯示from php
我想要一個按鈕上方的按鈕,當點擊將顯示或隱藏每個客戶的筆記行。到目前爲止,我的代碼似乎並沒有產生任何東西,我在這裏創建表:
echo "<table id='listTable' border='1' cellpadding='10' class='listTable'>";
echo "<tr> <th>ID</th> <th>First Name</th> <th>Last Name</th> <th>Company Name</th> <th>Telephone</th> <th>Alt/ Telephone</th> <th>Address </th> <th>Town</th> <th>Postcode</th> <th></th> <th></th> <th></th> <th></th></tr>";
// loop through results of database query, displaying them in the table
for ($i = $start; $i < $end; $i++)
{
// make sure that PHP doesn't try to show results that don't exist
if ($i == $total_results) { break; }
// echo out the contents of each row into a table
echo "<tr class='main'>";
echo '<td>' . mysql_result($result, $i, 'id') . '</td>';
echo '<td>' . mysql_result($result, $i, 'First_Name') . '</td>';
echo '<td>' . mysql_result($result, $i, 'Surname') . '</td>';
echo '<td>' . mysql_result($result, $i, 'Company_Name') . '</td>';
echo '<td>' . mysql_result($result, $i, 'Telephone') . '</td>';
echo '<td>' . mysql_result($result, $i, 'Alt_Telephone') . '</td>';
echo '<td>' . mysql_result($result, $i, 'line_1') . '</td>';
echo '<td>' . mysql_result($result, $i, 'town') . '</td>';
echo '<td>' . mysql_result($result, $i, 'postcode') . '</td>';
echo '<td><a href="edit.php?id=' . mysql_result($result, $i, 'id') . '">View</a></td>';
echo '<td><a href="delete.php?id=' . mysql_result($result, $i, 'id') . '">Delete</a></td>';
echo '<td><a href="archive.php?id=' . mysql_result($result, $i, 'id') . '">archive</a></td>';
echo '<td><a href="NewJob.php?id=' . mysql_result($result, $i, 'id') . '">New Job</a></td>';
echo "</tr class='notes'>";
echo "<tr>";
echo '<td>' . mysql_result($result, $i, 'notes') . '</td>';
echo "</tr>";
}
// close table>
echo "</table>";
,並具有以下JavaScript在我的代碼
<link rel="stylesheet" type="text/css" href="test.css"/>
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<html>
<head>
<title>View Records</title>
<script language="Javascript">
var rows = $('table.listTable tr.notes');
$('#showNotes').click(function() {
var showN = rows.filter('.showN').show();
rows.not(showN).hide();
});
</script>
</head>
的頂部,造成了進一步的向下切換按鈕
<button id="showNotes">Toggle Notes</button>
當我點擊按鈕,什麼也沒有發生
你有你在的結束標記類的'
回答
您添加
notes
類關閉標籤</tr>
。您有:
應該是:
和jQuery:
現在的一些言論有關代碼:
mysqli_*
,mysql_*
已棄用。'
:echo '<tr class="notes">'
看起來更好我認爲。for
環路):mysqli-stmt.fetch來源
2013-11-04 21:08:44 speccode
裹腳本在文件準備好功能:
來源
2013-11-04 21:02:56 WannaCSharp
相關問題