Jump to content

javascript in php code


leon

Recommended Posts

Hello, I was trying to insert rollover image script to php. But I dont think it will be easy. can you check this code please? How can it be adjusted?


[code]
<?php echo "<a href=\"$PHP_SELF?page=$pageNum&product_id={$data['id']}\" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image71','','{data['image_roll']}',1)">"; ?>
[/code]

Image_roll is the field from the database.
Link to comment
Share on other sites

you might be forgetting to escape your quotes. When using quotes within quotes, you need to put a backslash infront of the internal quote...

so, "\"" would equal "

I added backslashes to your code around the mouseover and mouseout -- should work fine now.


[code]
<?php echo "<a href=\"$PHP_SELF?page=$pageNum&product_id={$data['id']}\" onMouseOut=\"MM_swapImgRestore()\" onMouseOver=\"MM_swapImage('Image71','','{data['image_roll']}',1)\">"; ?>
[/code]
Link to comment
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.