Click to See Complete Forum and Search --> : Mouseover on one image creates an effect on another image


Wildflower
08-20-2003, 07:24 PM
Hi -

Can someone please take a look at the following page, view the source, and tell me what I'm doing wrong?

Unfortunately, I'm pretty JavaScript clueless but am trying to learn. The best way for me to learn is to write a script and then have someone modify it so that I can see what I'm doing wrong.

What I would like to happen is: When you click on "Monday," the "What's for Lunch" text should change to the lunch item for the day (monday_menu.jpg), etc.

Can someone help? (Actually, I'm not real sure how this insert hyperlink feature works - it doesn't even look like a link. Yes, I'm pretty forum-illiterate also!)

Wildflowerhttp://lunchmenu.wildatheartdesign.com

Exuro
08-20-2003, 08:00 PM
Okay, I think the problem is that you don't know how to use onMouseOver and onMouseOut. These are attributes of a tag, not a separate tag. So, since you're trying to call a function when the mouse moves over or off an image, you would place them inside the image tag. Also, when calling a function from inside one of these attributes, you must include the function name. I edited the Monday image to work with your code:

<p style="margin-top: 0px; margin-bottom: 0px">
<img border="0" src="monday.jpg" width="182" height="100" onmouseover="hiLite('img10','monday_menu')" onmouseout="hiLite('img10', 'whats_for_lunch')"></p>


You really should have those px after the zeros for the margin sizes too. Now, hopefully based off that you should be able to get the rest of the page to work as well. Good luck!

Wildflower
08-20-2003, 08:49 PM
It worked! Thanx SO much!

One of these days I'll find the time to read some JavaScript texts instead of trying to just wing it. :)