Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Popup image on mouseover in PHP

Status
Not open for further replies.

jongag1

Technical User
Feb 1, 2002
65
NL
Hello,

Our website is designed as follows:
There is a header.php file, a footer.php file and there are several content files, like personel.php which use the templates for the header and footer.
In the header.php file is all the javascript.

We would like to implement an image popup when our personel hoveres the mouse over the name of our employees which are showed in the personel.php file.

We tried the good looking script found on:
but were not able to get it to work.

The problem is that in personel.php we do a query (result is in $record->picture) for the image file name, but we cannot get it to send to the javascript.

I googled, but was not able to find a solution. I hope that somebody can help me out.

Kind regards,
Age
 
Of course you realize this is out of PHP's scope. All PHP can do is Provide the information, but its up to JS to create the popup.

If I were doing it I'd create a Invisible DIV that would contain the image to be shown for each entry in the list.

Something like:
Code:
<div id="imagediv" class="hiddenclass">
<?PHP
echo "<img src='".$img_src_from_DB ."'>";....

?>

Then on the link add something like:

<a href="...." OnMouseOver="document.imagediv.classname="visibleclass" OnMouseOut="document.imagediv.classname="hiddenclass">

</div>


Then have a style sheet for the classes hidden and visible classes.



This can all be generated dynamically form withing PHP, but the actual popup is created via JS.




----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top