Jump to content

Recommended Posts

I am trying to do a mouseover/mouseout on an image in a table. Right now I have it working with Javascript. You click on the camera and the image comes up in a new window. However; I want to do it with a mouseover like this.

 

http://www.menuhead.net/PopUP/mouseover-popup/over.php

 

I know mouseover is client side so how would I do this with php.

 

function newPopup(url) {
popupWindow = window.open(
 url,'popUpWindow','height=300,width=300,left=10,top=10,resizable=no,scrollbars=no,toolbar=no,menubar=no,location=no,directories=no,status=no'  )
}

 

<td><a href=Javascript:newPopup('$row[LocationPix]');><img src='http://www.menuhead.net/Images/Buttons/PShotClear.png'</td>

 

Thank you.

Link to comment
https://forums.phpfreaks.com/topic/274694-mouseover-in-php/
Share on other sites

I know mouseover is client side so how would I do this with php.

 

Since PHP is server side, and you know what you need to do is client side, what could you possibly be asking??

 

 

I think my favorite part is that you posted this in the MySQL help forum.

Edited by Jessica
Link to comment
https://forums.phpfreaks.com/topic/274694-mouseover-in-php/#findComment-1413458
Share on other sites

Closer, but still not the image.....

http://www.menuhead.net/PopUP/mouseover-popup/overthis.php

 

<td><a href ='#' id='trigger'('$row[LocationPix]');><img src='http://www.menuhead.net/Images/Buttons/PShotClear.png'</td>

 

$(function() {
 var moveLeft = 20;
 var moveDown = 10;
 $('a#trigger').hover(function(e) {
   $('div#pop-up').show();
 }, function() {
   $('div#pop-up').hide();
 });
 $('a#trigger').mousemove(function(e) {
   $("div#pop-up").css('top', e.pageY + moveDown).css('left', e.pageX + moveLeft);
 });
});

 

Now how to get the picture?

Link to comment
https://forums.phpfreaks.com/topic/274694-mouseover-in-php/#findComment-1413521
Share on other sites

The HTML you have posted is not valid unfortunately. For one you're not closing your IMG tag...

 

Unless you perhaps need something like this:

 

<td><a href='#' onclick='trigger("{$row[LocationPix]}");'><img src='http://www.menuhead.net/Images/Buttons/PShotClear.png' /></td>

 

Otherwise, as Jessica said I'm not entirely sure what you're asking.

Link to comment
https://forums.phpfreaks.com/topic/274694-mouseover-in-php/#findComment-1413557
Share on other sites

I know mouseover is client side so how would I do this with php.

 

 

To populate the anchor tag with a PHP variable, the variable needs to be enclosed in PHP tags:

 

<td><a href="#" onmouseover="newPopup('<?php print $row['LocationPix']; ?>');"><img src='http://www.menuhead.net/Images/Buttons/PShotClear.png' /></a></td>

 

Note that I moved the pop-up code to the "onmouseover" attribute.

Link to comment
https://forums.phpfreaks.com/topic/274694-mouseover-in-php/#findComment-1414810
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.