Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

mouseover question-on image map, image pops up when mouse is over area

Posted on 2004-04-12
4
Medium Priority
?
257 Views
Last Modified: 2008-03-10
I have a map of the US, and it is mapped so that clicking on a state will take you to another page of information, like this:

<img src="../images/northamerica.jpg" width="787" height="421" border="0" alt="" usemap="#locationmap"/>
     <map id="locationmap" name="location">

<area shape="rect" coords="28, 10, 83, 52" alt="AK"  href="the information  page." />
 
I would like to try to revamp it so that when someone's mouse is over Alaska, an image of a map of Alaska pops up. But I am pretty unacquainted with javascript, so please be very specific and simplistic for me, ok? Thanks in advance,

mel150
0
Comment
Question by:mel150
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 4

Accepted Solution

by:
monolith_888 earned 500 total points
ID: 10807965
Try this code out.  This will display the images you want in a specific spot on the page upon mousing over a state.  Just alter the .stateImg class to move the location of the image that appears.  Let me know if you have any questions.

-HTH
Blake

<html>
<head>
<title>Map</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style>
.stateImg      {position:absolute;top:10;left:500;}
</style>
<script>
function showImg(state)
      {
      var theState = document.getElementById(state);
      theState.style.display = "";
      }
      
function hideImg(state)
      {
      var theState = document.getElementById(state);
      theState.style.display = "none";
      }
</script>
</head>
<body>
<img name="test" src="quilt.gif" width="250" height="250" border="0" usemap="#m_test" alt="">

<img id="alaska" src="alaska.gif" class="stateImg" style="display:none;">
<img id="california" src="california.gif" class="stateImg" style="display:none;">
<img id="hawaii" src="hawaii.gif" class="stateImg" style="display:none;">
<img id="florida" src="florida.gif" class="stateImg" style="display:none;">
<map name="m_test">
<area shape="rect" coords="0,133,136,250" href="alaska.html" alt="" onMouseOver="showImg('alaska');" onmouseout="hideImg('alaska')">
<area shape="rect" coords="123,0,250,137" href="california.html" alt=""  onMouseOver="showImg('california');" onmouseout="hideImg('california')">
<area shape="rect" coords="132,144,249,237" href="hawaii.html" alt=""  onMouseOver="showImg('hawaii');" onmouseout="hideImg('hawaii')">
<area shape="rect" coords="0,0,127,125" href="florida.html" alt=""  onMouseOver="showImg('florida');" onmouseout="hideImg('florida')">
</map>
</body>
</html>
0
 

Author Comment

by:mel150
ID: 10808604
Hi-I'm not stalling on accepting this, just trying to make sense of it before I start. I'm sure I'll have a few question for yu soon, though. Thanks-it looks awesome.
0
 

Author Comment

by:mel150
ID: 10808750
You javascript guys! Just like magicians! Thanks, it worked like a charm.

Mel150
0
 
LVL 4

Expert Comment

by:monolith_888
ID: 10808840
Glad to help!

-blake
0

Featured Post

The top UI technologies you need to be aware of

An important part of the job as a front-end developer is to stay up to date and in contact with new tools, trends and workflows. That’s why you cannot miss this upcoming webinar to explore the latest trends in UI technologies!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

722 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question