I have a PHP function in an include file that allows you to do this, but
in reality, all it does is output the code for the Javascript mouseover
effect... The rollover() function is copied below (with CppDoc
compatable documentation comment)
Cheers,
Daniel
-Snip-
/*************** *************** *************** *************** *************** **
Creates a rollover button
@param $image_1 Name of the default image
@param $image_2 Name of the image to display when the mouse passes over
the image
@param $urllink Path or object that the text will be linked to
@param $ftarget Frameset target if used in a frame. If nothing is
specified, the target will not be used. If nothing is specified, and the
page is contained within a frame, the pane that contains the page that
uses this function will be replaced by the object defined in $linkpath.
@return Nothing
@since 1.0
*************** *************** *************** *************** *************** **/
function rollover($image _1,$image_2,$ur llink,$ftarget= "")
{
if ($ftarget != "") {
$ftarget = " target=\"$ftarg et\"";
}
echo <<<ROLLOVERHT ML
<a href="$urllink" $ftarget onMouseOver= "if (document.image s)
document.image1 .src= '$image_2';" onMouseOut= "if (document.image s)
document.image1 .src= '$image_1';"><i mg src= "$image_1" name="image1"
border=0></a>
ROLLOVERHTML;
print("<script language=\"java script\"><!-- if (document.image s) { var
IMAGE1=new Image();IMAGE1. src=\"$image_2\ ";}//--></script>");
}
-Snip-
Richard wrote:
I'm beginning to undertake php for the fun of it.
Working on a problem I hope can be solved in php.
Basically what I have is this:
<body>
<img name="main" src="image1.jpg ">
<a href="#"
onMouseOver="do cument.main.src ='image2.jpg'"
onMouseOut="doc ument.main.src= 'image1.jpg'">o ne</a>
</body>
Ok I know, shoot me. I know "name" is not a valid attribute but it works.
If I use "ID" it does not work.
How would I go about converting this same effect to PHP?