Search code examples
phponfocus

showing text when text get mousefocus


I need to show a couple of names when a especific text get focus. the code I have is:

$forum=mysql_query("SELECT * FROM forum ORDER BY cod_forum DESC") or die (mysql_error());
     while($de=mysql_fetch_array($forum)){
     $nomesfoto=mysql_fetch_array(mysql_query("SELECT nome,foto FROM logins WHERE cod_login='$de[1]'")) or die (mysql_error());
     echo"<h3 id='pipi'><img src='$nomesfoto[1]' width='50' height='70'> Postado por:<b> $nomesfoto[0] </b>em $de[3] </h3>";
     echo"<p id='maior'> $de[2] </p>";
     echo "<span class='like'>".$de[5]."</span>";
     echo"<input class='porreiro' type='button' name='like' value=''><br>";
     echo"<hr></hr>";
     }

the $de[5] show the number os likes of a comment. What I want is, when that number get focus of the mouse, to be showed the names os the persons who did the like. I just need the onfocus code... getting the names it's already done in another part of my code. thank you


Solution

  • You can try setting a title on the <span>, most browsers will show a tooltip for such an element on mouse over

    echo "<span class='like' title='" . $names . "'>".$de[5]."</span>";
    

    Otherwise pick a jQuery tooltip plugin and implement it.