PDA

View Full Version : onmouseover event with <img> and <a>


Ricky158
10-21-2002, 05:01 AM
hello, once again my faithfull programming *geniuses*. i have returned once more with yet another problem. i am trying to have the onmouseover event change one pic to another, while having both pics be a link to a site.

heres the code i have so far;

<A href="http://angelfire.com/extreme3/waterguns" onMouseout="document.linkpic.src='linkpic.jpg'; returnstatus();" onMouseOver="document.linkpic.src='linkpic2.jpg'"><IMG name="linkpic" src="linkpic.jpg" border="0" ></A>

everything looks fine when i put the mouse over the image, but when i pull the cursor out of the image, i see the little thing in the status bar tell me there's an error. and the error persists even if i put the cursor back in the image field.

any help is certainly appreciated. thanks.


EDIT; fixed a notable spelling error

adios
10-21-2002, 05:12 AM
What be this?

returnstatus();

...and we're "geniuses"...

cg9com
10-21-2002, 05:58 AM
try

<a onMouseOver="document.Image.src='Button(2).gif'"
onMouseOut="document.Image.src='Button(1).gif'">
<IMG SRC="Button(1).gif" BORDER=0 NAME="Image"></a>

if you plan on having more than one mouseover picture you will need to change "Image" everywhere on that code to another name for each new time

im not a genious or a genius

Ricky158
10-22-2002, 02:53 AM
Originally posted by adios
...and we're "geniuses"...

obviously i'm not :p


the returnstatus() thing is something i copied from an archived thread here. i copied the code and replaced the variables and stuff with the things i need. but i get an error. i'm relatively new to the language (the computer language, not the english language...) so i can't spot an error as quickly as many others can.


thanks, cg9, i'll try that code.

chrismiceli
10-22-2002, 02:59 AM
if you take out the

; returnstatus()

it should work just fine.

Ricky158
10-22-2002, 03:26 AM
thanks. that last code worked. i didnt even get around to testing the first one, but it was a lot simpler just to remove the faulty returnstatus() thing.

thanks again cg9 and chris.

cg9com
10-22-2002, 04:17 AM
anytime