鼠标经过图片时换图片,同时图片放大。

html代码:

<div style="width:182px; height:182px; border:1px solid #FFF;">
<div id="img1" style=" margin:20px; ">
<img id="aboutusimg1" src="aboutUs/1.png" width="142" height="142" onmousemove="changeImagemove1()" onmouseout="changeImageout1()" />
</div>
</div>

js代码:

function changeImagemove1()
{
var element=document.getElementById("aboutusimg1");
element.width = "202";
element.height= "202";
element.src = "aboutUs/1-1.png";
document.getElementById("img1").style.margin="0";
}
function changeImageout1()
{
var element=document.getElementById("aboutusimg1");
element.src = "aboutUs/1.png";
element.width = "142";
element.height= "142";
document.getElementById("img1").style.margin="20px";
}

posted @ 2017-04-19 19:24  树叶的一生  阅读(330)  评论(0编辑  收藏  举报