Link to home
Start Free TrialLog in
Avatar of cquinn
cquinnFlag for United Kingdom of Great Britain and Northern Ireland

asked on

onMouseOver in Image Maps

I have an image map set up and wish to set the contents of the status bar when the mouse is moved over the various image sections.  I have added an onMouseOver and onMouseOut event to each of the <AREA> tags, but when the mouse moves over it, it just shows the HREF of the area.
Does the <AREA> tag support these events?

The HTML I'm using is below.

<table width="100%" bgcolor=#66ffff cellspacing="0" cellpadding="3">
  <tr>
    <td>
      <br><br><center><b>Organisational Structure Diagram</b></center>
    </td>
  </tr>
  <tr>
    <td align=center>
      <img src="/images/orghierarch.gif" border="0" usemap="#hierarchy">
    </td>
  </tr>
</table>
<MAP NAME="hierarchy">
 <AREA onClick="funOrg('RO');return false;" SHAPE=rect COORDS="220,8,415,62" HREF="#" title="Regional Offices" onMouseOver="status='Show Regional Offices';return true" onMouseOut="window.status='';return true">
 <AREA onClick="funOrg('TR');return false;" SHAPE=rect COORDS="15,95,189,149" HREF="#" title="Trusts" onMouseOver="status='Show Trusts';return true" onMouseOut="window.status='';return true">
 <AREA onClick="funOrg('TS');return false;" SHAPE=rect COORDS="15,181,187,235" HREF="#" title="Trust Sites" onMouseOver="status='Show Trust Sites';return true" onMouseOut="window.status='';return true">
 <AREA onClick="funOrg('HA');return false;" SHAPE=rect COORDS="220,95,415,149" HREF="#" title="Health Authorities" onMouseOver="status='Show Health Authorities';return true" onMouseOut="window.status='';return true">
 <AREA onClick="funGP('GMPP');return false;" SHAPE=rect COORDS="220,354,415,408" HREF="#" title="General Practitioners" onMouseOver="status='Show GPs';return true" onMouseOut="window.status='';return true">
</MAP>
Avatar of COBOLdinosaur
COBOLdinosaur
Flag of Canada image


You have to remove the href. It uses up the mouseevent.  You are firing from
the onClick anyway so you don't need it. The mouseover is firing but is
hidden by the href mouseover.

Cd&
Avatar of cquinn

ASKER

Dino - this works, but has an unwanted side-effect - the cursor no longer turns to a hand when the mouse is placed over one of the image segments - obviously because there is no longer a hyperlink associated with the area tags.

Is there any way of having both?
ASKER CERTIFIED SOLUTION
Avatar of COBOLdinosaur
COBOLdinosaur
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of cquinn

ASKER

Thanks for that - you answered the original question, so you get the points.  I'll just have to ask the customer which they prefer and tell them they can't have both.
Yeah, I've been there... I usually hear:"it seems it should be simple to do
both"...  Sometimes it is not easy being a developer, but it's just to much
fun to to give it up for a real job like truck driving.  Thanks for the A,
and good luck with the customer. :^)

Cd&
Avatar of MakiG
MakiG

I know a way that you can get around this...

All you need to do is change your onMouseOver event to an onMouseMove event

This error doesn't seem to occur on all browsers... for example Mozilla doesn't have this problem, however explorer does.  All that is happening is the href's onMouseOver eventhandler changes the status after you change it with your onMouseOver event (basically writing over it).  So what you need to do is write over it after the href does.  That is what the onMouseMove does for you.

This may be too late for you do anything about it, but just so you know for future reference...

-MakiG