JS使用oumousemove和oumouseout动态改变图片显示的方法

时间:2015-03-31    点击:113   

本文实例讲述了JS使用oumousemove和oumouseout动态改变图片显示的方法。分享给大家供大家参考。具体如下:

鼠标放到图片上时图片会自动变大,鼠标离开图片还原

<!DOCTYPE html>
<html>
<head>
<script>
function bigImg(x)
{
x.style.height="64px";
x.style.width="64px";
}
function normalImg(x)
{
x.style.height="32px";
x.style.width="32px";
}
</script>
</head>
<body>
<img onmouseover="bigImg(this)" onmouseout="normalImg(this)"
border="0" src="smiley.gif" alt="Smiley" width="32" height="32">
<p>The function bigImg() is triggered when the user moves
the mouse pointer over the image.</p>
<p>The function normalImg() is triggered when the mouse
pointer is moved out of the image.</p>
</body>
</html>

希望本文所述对大家的javascript程序设计有所帮助。

JS动态修改图片的URL(src)的方法
JavaScript之数组(Array)详解
JavaScript中使用Object.prototype.toString判断是否为数组
JavaScript判断字符长度、数字、Email、电话等常用判断函数分享
JavaScript操作DOM元素的childNodes和children区别
> 返回     
地址:上海市普陀区胶州路941号长久商务中心 电话: QQ:
© Copyright 2012 上海网络 Product All Rights Reserved