View Full Version : Is there a DHTML script that will do this?
04-28-2005, 04:41 PM
What I need is a standard menu with mouseover effect, but in addition to the mouse over effect on the menu, it also needs to change an image in a map I have on the page. There will be a list of roads on one side and a map on the other, so when the user mouses over the street, it will highlight, and also highlight the street on the map (by changing the image to one with that street highlighted). Sorry if this is a basic question, but I have searched all the scripts and don't see one that can do this. Thanks!
05-05-2005, 07:00 AM
For a menu item:
<span onmouseOver="this.style.background='yellow';mapImg.src='elm_highlight.jpg'" onmouseOut="this.style.background='white'">Elm Street</span>and for the map:
<img src="default_map.jpg" name="mapImg">How you lay these out on your page is up to you, as is the highlight color (here yellow) and color of the unhighlighted text's background (here white). If, instead of a background color highlight, you want the foreground color of the text to change, substitute 'color' for 'background' in the above. If you want 'Elm Street' (the text) to remain highlighted until a different street is selected, skip the onmouseOut statement.
Also, for practical reasons which should become clear when you actually try this out, you might prefer to have the image change onClick rather than onmouseOver. Like this:
<span>Click below to select Highlighted Map</span><br>
<span onmouseOver="this.style.background='yellow'" onClick="mapImg.src='elm_highlight.jpg'" onmouseOut="this.style.background='white'">Elm Street</span>
Powered by vBulletin® Version 4.2.1 Copyright © 2014 vBulletin Solutions, Inc. All rights reserved.