« Nothing beats Perl to solve a data manipulation requirement quickly | Main | Patterns in street names »

April 16, 2009

Javascript - move cursor over image to change a different image.

Let's imagine that you have an image which is a map on your web page, and as you move over the map you want another image (elsewhere on the page) to change to show the place you're pointing too. Well - it can be done with Javascript, but it's not necessarily easy to find a simple example online ... which is probably why one of my customers asked me how to do it.

Try it out at http://www.wellho.net/demo/terry2.html and see the source code at http://www.wellho.net/resources/ex.php4?item=w602/terry2.html.

If you look at the source code, you'll find a lot of repeated code - not a good idea in the long term, but it will help you see what I have done and how I have done it.

P.S. The original question wasn't about maps and places - it was about a football team and showing pictures of their favourite foods. Yes, it should work for them too!

Posted by gje at April 16, 2009 03:06 PM

Comments

Well House Consultants Ltd. Copyright 2010