JS实现图片的放大和缩小
程序员文章站
2024-03-24 09:20:10
...
示例代码:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<script type="text/javascript">
function bigImg(x)
{
x.style.height="214px";
x.style.width="214px";
}
function normalImg(x)
{
x.style.height="114px";
x.style.width="114px";
}
</script>
</head>
<body>
<!--实现图片的放大和缩小 定义两个事件,绑定两个函数-->
<img onmousemove="bigImg(this)" onmouseout="normalImg(this)" border="0" src="img/HBuilder.png" alt="Smiley" >
</body>
</html>
效果: