views:

331

answers:

3

How do I change the border of an image map(on mouse over) that i have placed over a part of the image

+1  A: 

You can use jQuery:

$('#imagemapid').mouseover(function() {
    $(this).css("border","solid 1px red");
});
Ropstah
+1  A: 

If you do use jQuery, which would be wise, use hover so you can remove the border as well.

$('#imagemapid').hover(
  function() {
    $(this).css("border","solid 1px red");
  },
  function() {
    $(this).css("border","none");
  }
);
altCognito
+1  A: 

Since you ask in javascript then I'll fist show your desired solution

 function imageon(here) 
{

   var elem= document.getElementById(here);
   elem.style.border = "solid 2px grey";
}

in jquery you can just do this

$(function(){
 $('#d1').mouseover(function() { 
 $(this).css("border","solid 2px grey");
 });
});

with html like this

<img name="d1" id="d1" href="LINK #1" onmouseover="imageon('d1');" >
TStamper