<html>
<head></head>
<body>
<img src="2.jpg" onmouseover="this.style.border='10px solid black'" onmouseout="this.style.border=''"/>
</body>
</html>

解决方案 »

  1.   

    当然,你也可以事先得到你想要添加效果的img的数组,然后动态的为他们添加mouseover和out的事件处理方法
      

  2.   

    也可用CSS实现:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>图片动态边框</title>
    </head>
    <style type="text/css">
    img:hover{ border:1px #000000 solid;}
    </style>
    <body>
    <img src="Img/00.gif" border="0" />
    </body>
    </html>
      

  3.   

    如果图片多的话用CSS是最好的选择
    <style type="text/css">
    img:hover{ ..//可以自己定义边框样式}
    </style>
    如果少的话就一张一张加也可以,不过如果图片经常有变动的话还是建议用CSS
      

  4.   

    把图片用div包起来,让图片充满整个div,div套CSS,边框是div的边框。不会有抖动
      

  5.   

    IE不支持除a外的其他标签加伪类吧