Hi,
I am trying to convert my html code to a php script. For example my html: <img src="images/tryitfree.jpg" name="Image68" width="290" height="66" border="0">
becomes <?php print getOffer(1, '<img src="images/tryitfree.jpg" alt="my image" />'); ?>
This works well enough except that my html code is more complex as the image changes when it is moused over. So the html actually looks like this:
<a href="#" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image68','','images/index-html-final_28.jpg',1)"><img src="images/tryitfree.jpg" name="Image68" width="290" height="66" border="0"></a>
My question is how to code this in php? How do I include this mouseover image while still coding it in PHP as above.
Any help or suggestions is greatly appreciated.
Thanks
Dsanche
how do i replace this html code with php?
Moderator: General Moderators
Re: how do i replace this html code with php?
To write;
In php I would;
Or;
Is this what you want?
Code: Select all
<a href="#" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image68','','images/index-html-final_28.jpg',1)"><img src="images/tryitfree.jpg" name="Image68" width="290" height="66" border="0"></a>
Code: Select all
<?php
//some php code
echo "<a href=\"#\" onMouseOut=\"MM_swapImgRestore()\" onMouseOver=\"MM_swapImage('Image68',\'','images/index-html-final_28.jpg',1)\"><img src=\"images/tryitfree.jpg\" name=\"Image68\" width=\"290\" height=\"66\" border=\"0\"></a>";
//some more php code
?>
Code: Select all
<?php
//some php code
?>
<a href="#" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image68','','images/index-html-final_28.jpg',1)"><img src="images/tryitfree.jpg" name="Image68" width="290" height="66" border="0"></a>
<?php
//some more php code
?>
Re: how do i replace this html code with php?
Thanks for the response.
I am basically trying to integrate this html code : <a href="#" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image68','','images/index-html-final_28.jpg',1)"><img src="images/tryitfree.jpg" name="Image68" width="290" height="66" border="0"></a>
into this code:
<?php print getOffer(1, '<img src="images.jpg" alt="my image" />'); ?>
it would be easy if i was just using a simple image. In PHP it would look like: <?php print getOffer(1, '<img src="images/tryitfree.jpg" alt="my image" />'); ?>
But how do i do this so that the mouse over code is included as well?
I hope thats more clear
dsanche
I am basically trying to integrate this html code : <a href="#" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image68','','images/index-html-final_28.jpg',1)"><img src="images/tryitfree.jpg" name="Image68" width="290" height="66" border="0"></a>
into this code:
<?php print getOffer(1, '<img src="images.jpg" alt="my image" />'); ?>
it would be easy if i was just using a simple image. In PHP it would look like: <?php print getOffer(1, '<img src="images/tryitfree.jpg" alt="my image" />'); ?>
But how do i do this so that the mouse over code is included as well?
I hope thats more clear
dsanche