Hi guys! There is a dynamic table of the latest news. They are represented by links. I’m trying to implement a feature where when you hover your mouse on the link to display a small image of the news and a short text (description).
Found the implementation of java. Here’s the code java script:
function showImg(id,fn){
var el = document.getElementById(id);
if(fn) el.innerHTML = '<img src="' + fn + '" />'; else el.innerHTML ='';
}
And here’s the code of the table of the latest news (output images works):
<?php $query_news = mysql_query("SELECT * FROM `news` ORDER BY `id` DESC LIMIT 70") or die(mysql_error());
echo "<table cellpadding='0' cellspacing='0' border='0' >";
$i = 0;
while ($result_news = mysql_fetch_assoc($query_news))
{
echo "<tr><td>";
{
echo "<a class='link1' href='?action=news_inf&id=".$result_news['id']."' onmouseover=\"showImg('img".++$i."','http://www.domain.com/image/news/".$result_news['img']."')\"onmouseout=\"showImg('img".$i."','')\"> ".htmlspecialchars($result_news['title'], ENT_QUOTES)."</a>";
}
echo "<div id='img".$i."'></div></td></tr>";
}
echo "</table>";
How do I implement a description display near the picture? Descriptions I call php code echo “. $result_news [‘description’].”.
Thanks!