2012-02-02 78 views
0

我在我的數據庫表,我打電話給在表格中顯示的項目之一在頁面上該表中的一切是當鼠標滑過需要的圖像,顯​​示出從一個單獨的數據的彈出對應於該項目的表格。我有一個JQuery根據第一個表中的行調用數據,但是當我嘗試將兩者放在一起時,第一個表格顯示正常,但現在我沒有在mouseover上彈出。的onmouseover沒有顯示DIV

此頁面當前包含在index.php頁面中,該頁面包含調用.js/.css文件的腳本。

下面是什麼,我試圖做的代碼:

 <html> 




    <table border='0' cellpadding='0' cellspacing='0' class="center2"> 
    <tr> 
    <td width='60'><img src="images/box_tl.png"></td> 
    <td style="background: url(images/box_tm.png)" align="center"><img src="images/news.png"></td> 
    <td width='25'><img src="images/box_tr.png"></td> 
    </tr> 
    <tr> 
    <td style="background: url(images/box_ml.png)"><h2>.</h2></td> 
    <td style="background: url(images/box_mm.png)"> 


<?php 
include 'connect.php'; 

$query = mysql_query("SELECT * FROM tbl_img") or die(mysql_error());; 

echo "<table border='0' cellpadding='1' cellspacing='1' width'90%' id='1' class='tablesorter'><thead>"; 
echo "<tr> <th> </th> <th>Mob Name</th> <th>Id</th> <th>Health</th> <th>Body</th> <th>Effects</th> <th>Spawn</th></tr></thead><tbody>"; 
// keeps getting the next row until there are no more to get 

while($row = mysql_fetch_array($query)) { 

$mob_id = $row['mob_id']; 
$mob = $row['mob']; 
$body = $row['body']; 
$mob_name = $row['mob_name']; 
$health = $row['health']; 
$level = $row['level']; 

// Print out the contents of each row into a table 
echo "<tr><td>"; 
echo "<img src='/testarea/include/mobs/$mob' />"; 
echo "</td><td>"; 
echo $mob_name; 
echo "</td><td>"; 
echo $level; 
echo "</td><td>"; 
echo $health; 
echo "</td><td>"; 
echo 


" 
<a onmouseover='popup($('#hidden-table').html(), 400);' href='somewhere.html'><img src='/testarea/include/mobs/dead/$body' /></a> 
"; 

echo " 

<div id='hidden-table' style='display:none;'> 
<table border='0' cellpadding='0' cellspacing='0' class='center3'> 
    <tr> 
    <td width='14'><img src='images/info_tl.png'></td> 
    <td style='background: url(images/info_tm.png)' align='center'></td> 
    <td width='14'><img src='images/info_tr.png'></td> 
    </tr> 
    <tr> 
    <td style='background: url(images/info_ml.png)'><h2>.</h2></td> 
    <td style='background: url(images/info_mm.png)'> 
"; 




$query2 = mysql_query("SELECT * FROM tbl_drop WHERE mob_name='$mob_name'") or die(mysql_error());; 

echo "<table border='0' cellpadding='1' cellspacing='1' width='250' id='2' class='tablesorter'><thead>"; 
echo "<tr> <th> </th> <th>Item Name</th> <th>Qty</th></thead><tbody>"; 
// keeps getting the next row until there are no more to get 

while($row = mysql_fetch_array($query2)) { 

$id = $row['id']; 
$item_img = $row['item_img']; 
$qty = $row['qty']; 
$item_name = $row['item_name']; 


// Print out the contents of each row into a table 
echo "<tr><td width='50'>"; 
echo "<img src='/testarea/item/$item_img' />"; 
echo "</td><td width='150'>"; 
echo $item_name; 
echo "</td><td width='50'>"; 
echo $qty; 
echo "</td></tr>"; 
} 

echo "</tbody></table>"; 


echo " 
    </td> 
    <td style='background: url(images/info_mr.png)'><h2>.</h2></td> 
    </tr> 
    <tr> 
    <td width='14'><img src='images/info_bl.png'></td> 
    <td style='background: url(images/info_bm.png)' align='center'><h2>.</h2></td> 
    <td width='14'><img src='images/info_br.png'></td> 
    </tr> 
    </table> 
</div>" 




; 
echo "</td><td>"; 
echo "test"; 
echo "</td><td>"; 
echo "test"; 
echo "</td></tr>"; 
} 

echo "</tbody></table>"; 

?> 




    </td> 
    <td style="background: url(images/box_mr.png)"><h2>.</h2></td> 
    </tr> 
    <tr> 
    <td width='60'><img src="images/box_bl.png"></td> 
    <td style="background: url(images/box_bm.png)" align="center"><h2>.</h2></td> 
    <td width='25'><img src="images/box_br.png"></td> 
    </tr> 
    </table> 

</html> 
+0

「;在開始的你的最後一個代碼塊是一個錯字? – 2012-02-02 19:26:48

+0

不,所有3塊代碼都只是一個塊,我只是分開它們來顯示問題的位置 – zhaobaloth 2012-02-02 19:34:25

+0

如果我使用:echo include('info2.php');而不是中間塊的文本來調用中間塊,然後我得到彈出我想要但這導致圖像不t o顯示和第一個表只顯示第一行 – zhaobaloth 2012-02-02 19:36:30

回答

0

您對本線上的兩個分號......可問題

$query = mysql_query("SELECT * FROM tbl_drop WHERE mob_name='$mob_name'") or die(mysql_error());; 
+0

刪除額外的分號似乎沒有任何區別,ive用新代碼更新了主要問題,所以現在可以給出更好的想法 – zhaobaloth 2012-02-02 19:58:10