写了个例子: <a href="#"><img src="http://csdnimg.cn/pubfooter/images/gongshang_logos.gif" border="0" onMouseOver="this.src=‘http://www.baidu.com/img/baidu_jgylogo3.gif?v=07491728.gif‘" onMouseOut="this.src=‘http://img.baidu.com/img/logo-zhidao.gif‘" /></a>
在动态代码中的写法:
<img src="images/red‘+i+‘s.png" style="width:20px;height:29px;" onMouseOver="this.src=\‘images/blue‘+i+‘s.png\‘"; onMouseOut="this.src=\‘images/red‘+i+‘s.png\‘;">
实现效果
初始状态:
鼠标滑动上:
鼠标移开:
css滑动鼠标到img后,切换图片,布布扣,bubuko.com
原文地址:http://blog.csdn.net/zjplovemm/article/details/38494997