Forum Moderators: open

Message Too Old, No Replies

onClick after onMouseOver

         

Sulkyrob

10:43 am on Mar 30, 2009 (gmt 0)

10+ Year Member



I have a map area tagged and when there is mouseover on a particular country I want to show a set of images as a montage at the side of that page. On mouseout that image changes to another set in the same place.
When the mouse is clicked while over that country I want to go to a hyperlink using the same window.

The code I have in the Head is:-

function gotoURL(url){
location.href=url;
}

function ShowPic(sImage)
{
document.ShowCountry.src = sImage;
}

function mouseOver()
{document.ShowCountry.src =sImage;}
function mouseOut()
{document.ShowCountry.src="example.jpg";}

The code in the body is:-

<area onMouseOver="ShowPic(this.href)" href="example2.jpg" onMouseOut="mouseOut()" alt="Go to Images of example2" href="ExampleCountry.htm" onClick="gotoURL('ExampleCountry.htm')" shape="polygon" coords="95, 170, 162, 169, 190, 181, 206, 172, 209, 177, 180, 200, 183, 215, 171, 205, 148, 209, 105, 197, 95, 185">

This code currently correctly displays as required for mouseover and mouseout but onclick I do not get my ExampleCountry.htm but only example2.jpg

Would appreciate some help on what is wrong please...and please keep it simple if possible - I'm very much a newbie to coding :)

daveVk

12:17 pm on Mar 30, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Why 2 href's ? Try taking out the first, and also the onclick, you don't need belt and braces.

Also change
ShowPic(this.href)
to
ShowPic('example2.jpg')

Welcome

Sulkyrob

9:58 pm on Mar 30, 2009 (gmt 0)

10+ Year Member



Brilliant - problem solved. Thanks very much!