Javascript 更改图像地图上的边框

Javascript 更改图像地图上的边框,javascript,html,border,mouseover,Javascript,Html,Border,Mouseover,如何更改已放置在部分图像上的图像贴图(鼠标悬停)的边框您可以使用jQuery: $('#imagemapid').mouseover(function() { $(this).css("border","solid 1px red"); }); 如果您确实使用jQuery,那么最好使用hover,这样您也可以删除边框 $('#imagemapid').hover( function() { $(this).css("border","solid 1px red"); }

如何更改已放置在部分图像上的图像贴图(鼠标悬停)的边框

您可以使用jQuery:

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

如果您确实使用jQuery,那么最好使用hover,这样您也可以删除边框

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

既然您在javascript中提问,那么我将首先展示您想要的解决方案

 function imageon(here) 
{

   var elem= document.getElementById(here);
   elem.style.border = "solid 2px grey";
}
jquery中,您可以这样做

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

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