<img id="img" onmouseover="bigger()" onmouseout="smaller()" src="你的图片路径" style="cursor:pointer;width:100px;height:100px;" />
<script type="text/javascript">
var img = document.getElementById('img');
function bigger(){
img.style.width = '400px';
img.style.height = '400px';
}
function smaller(){
img.style.width = '100px';
img.style.height = '100px';
}
</script>
本文介绍了一种通过JavaScript实现的图片鼠标悬停放大缩小效果。利用onmouseover和onmouseout事件改变图片大小,实现了图片在用户交互过程中的动态变化。
5831





