我現在有一些問題,我的代碼有一些奇怪的行爲,無法找到原因。下拉列表奇怪地顯示出表
我有一個分機表(電話)分配給一個qeue。我通過SQL查詢獲取數據,然後在屏幕上顯示它。 顯示的數據之一是優先級,我想通過選擇一個新的下拉列表來更改jquery + ajax。
所以,我管理這個代碼:
echo '<table cellpadding="5" cellspacing="0" width="30%" id="deletion" bgcolor="#f6f6f6" style="border:1px solid #cccccc;">
<tr>
<th><strong>Extension</strong></th>
<th><strong>Priority</strong></th>
<th> </th>
</tr>';
while ($datos_extension = mysql_fetch_array($result)){
echo '<tr id="'.$extension_data['id'].'"><td>'.$extension_data['extension'].'</td><td>'.show_priority($datos_extension['priority']).'</td><td><a href="#" class="delete negative button"><span class="cross icon"></span>Delete</a></td></tr>';
}
echo "</table>";
現在,功能:
function show_priority ($priority) {
$max_priority = 3;
$cont = 1;
echo '<select name="priority" class="priority">';
while ($cont <= $max_priority) {
echo '<option';
if ($cont == $priority)
echo " selected";
echo ' value="'.$cont.'">'.$cont.'</option>';
$cont ++;
}
echo "</select>";
}
但它顯示的下拉菜單出表的......下面是HTML輸出:
<tr>
<th><strong>Extension</strong></th>
<th><strong>Priority</strong></th>
<th> </th>
</tr><select name="priority" class="priority"><option selected value="1">1</option><option value="2">2</option><option value="3">3</option></select><tr id="2"><td>1002</td><td></td><td><a href="#" class="delete negative button"><span class="cross icon"></span>Delete</a></td></tr><select name="priority" class="priority"><option selected value="1">1</option><option value="2">2</option><option value="3">3</option></select><tr id="3"><td>1003</td><td></td><td><a href="#" class="delete negative button"><span class="cross icon"></span>Delete</a></td></tr><select name="priority" class="priority"><option selected value="1">1</option><option value="2">2</option><option value="3">3</option></select><tr id="4"><td>1004</td><td></td><td><a href="#" class="delete negative button"><span class="cross icon"></span>Delete</a></td></tr><select name="priority" class="priority"><option selected value="1">1</option><option value="2">2</option><option value="3">3</option></select><tr id="5"><td>1005</td><td></td><td><a href="#" class="delete negative button"><span class="cross icon"></span>Delete</a></td></tr><select name="priority" class="priority"><option selected value="1">1</option><option value="2">2</option><option value="3">3</option></select><tr id="6"><td>1006</td><td></td><td><a href="#" class="delete negative button"><span class="cross icon"></span>Delete</a></td></tr><select name="priority" class="priority"><option selected value="1">1</option><option value="2">2</option><option value="3">3</option></select><tr id="7"><td>1007</td><td></td><td><a href="#" class="delete negative button"><span class="cross icon"></span>Delete</a></td></tr><select name="priority" class="priority"><option selected value="1">1</option><option value="2">2</option><option value="3">3</option></select><tr id="8"><td>1008</td><td></td><td><a href="#" class="delete negative button"><span class="cross icon"></span>Delete</a></td></tr><select name="priority" class="priority"><option selected value="1">1</option><option value="2">2</option><option value="3">3</option></select><tr id="9"><td>1009</td><td></td><td><a href="#" class="delete negative button"><span class="cross icon"></span>Delete</a></td></tr><select name="priority" class="priority"><option value="1">1</option><option selected value="2">2</option><option value="3">3</option></select><tr id="10"><td>9003</td><td></td><td><a href="#" class="delete negative button"><span class="cross icon"></span>Delete</a></td></tr></table>
是否有人知道它可能是什麼問題?
謝謝,它的工作原理,我不知道這種行爲 – 2011-03-17 10:15:47