2012-02-02 3 views
0

div 'hidden-table'이 표시되지 않는 경우 'style : display : none'을 제거하면 표시됩니다. 올바른 데이터가 포함 된 표가 표시되어 작업을 시도하고 있습니다. 메아리에서 팝업을 꺼내서 별도로 표시하는 것입니다. div가 onmouseover와 함께 표시되지 않음

문제 만 발생했을 때의를 에코에서하고 'onmousover'를 중심 보인다 보인다

전체 페이지 코드 :

<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=''><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

javascript 함수'popup'가 정의됩니다. 여기서? – Hamish

+2

코드가 너무 많아서이 공격을 알 수 없습니다. –

+1

그래서 문제가 클라이언트에 있다면이 모든 서버 측 코드가 왜 포함되어 있습니까? –

답변

0

당신이 참조 할 때 당신은 실수로 onmouseover 이벤트를 종료하고 귀하의 jQuery 선택기. 여러 가지 이유로 작은 따옴표를 사용하는 것이 그 이유입니다. 대신 다음을 시도하십시오 :

function ShowPop() 
{ 
    popup($('#hidden-table').html(), 400); 
} 

<a onmouseover='ShowPop()' href=''><img ..... /></a> 
+0

팝업을 표시 할 수 있지만 이제 각각의 팝업에 동일한 데이터를 표시합니다. 다른 행의 이미지 – zhaobaloth

관련 문제