鼠标放到图片上慢慢变大,移开后图片又慢慢变小.html

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>网页特效观止|www.jscode.cn| --- 鼠标放到图片上慢慢变大,移开后图片又慢慢变小</title>

</head>

<body>
<img id=MainImg onmouseover=max() onmouseout=min() src=http://www.jscode.cn/JsCode/images/flag.gif width="85" height="55">
<script>
var i=0
//变大
function max(){
MImg=MainImg.style.pixelWidth+=i++
MainImg.style.pixelHeight=MImg*aaa
if(i<20)setTimeout('max()',100)
}

//变小
function min(){
MImg=MainImg.style.pixelWidth-=i--
MainImg.style.pixelHeight=MImg*aaa
if(i>0)setTimeout('min()',100)
}

function init(){
aaa=MainImg.height/MainImg.width
MainImg.style.pixelWidth=85
MainImg.style.pixelHeight=55
}

onload=init
</script></body>
</html>

by 雪洁 2010-05-24 22:48:23 5951 views
我来说几句

相关文章