Jump to content

Recommended Posts

Sorry if this is the wrong place as it is 50/50 javascript and php

 

I am trying to mouseover an image and  swap the image but if the 2nd image is not the primary model then display the image and a message to that extent.

 

This is what I have tried (with many variations) but cant get it to work .

 

$pic_name = original image

$pic2name = swapped image

 

<a href=" my file..."     target="popup"   onclick="msgopen('my file ...'); return false;"   />
     

     <img src="<?=$pic_name?>"  name="<?=$counter?>"  onMouseOver=" document.<?=$counter?>.src='<?=$pic2name ?>'"; return escape('Image is of Parent Stock Only') ;            

 

      onMouseOut="document.<?=$counter?>.src='<?=$pic_name?>';">

 

 </a>

 

There are many images on the screen hence the name="<?=$counter?>"

 

Any help is greatly appreciated

Link to comment
https://forums.phpfreaks.com/topic/285820-return-2-actions-from-onmouseover/
Share on other sites

Instead of using    document.<?=$counter?>   in OnMouseOver/Out use   this

<a href=" my file..."     target="popup"   onclick="msgopen('my file ...'); return false;"   />
     <img src="<?=$pic_name?>"  name="<?=$counter?>"  onMouseOver="this.src='<?=$pic2name ?>'; return escape('Image is of Parent Stock Only';"
                                                      onMouseOut="this.src='<?=$pic_name?>';">
 </a>

Thank you for the reply.

 

Unfortunately this did not do the trick.

 

The result was that it showed the 2nd (rolled over) image only with no message being displayed. Have I missed something.

 

This is the actual code :

                            <a href="expand.php?model=<?=$row[model_number]?>&page=<?=$page?>&prime=<?=$row[prime]?>"
                                target="popup"
                                onclick="msgopen('expand.php?model=<?=$row[model_number]?>&page=<?=$page?>&prime=<?=$row[prime]?>', 'popup', 900, 600); return false;"
                               />
                                <img src="<?=$pic_name?>" name="<?=$row[model_number]?>" height="<?=$height?>" width="<?=$width?>" onMouseOver=" this.src='<?=$pic2name?>'; return escape('Image is of Parent Stock Only');"             onMouseOut="this.src='<?=$pic_name?>';"><br />
                           </a>

 

Any clues ?

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.