鼠标放到图片上慢慢变大,移开后图片又慢慢变小
from: http://www.jscode.cn/jave_img/350605691.htm
1 <html>
2 <head>
3 <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
4 <title>网页特效观止|www.jscode.cn| --- 鼠标放到图片上慢慢变大,移开后图片又慢慢变小</title>
5
6 </head>
7
8 <body>
9 <img id=MainImg onmouseover=max() onmouseout=min() src=http://www.jscode.cn/JsCode/images/flag.gif width="85" height="55">
10 <script>
11 var i=0
12 //变大
13 function max(){
14 MImg=MainImg.style.pixelWidth+=i++
15 MainImg.style.pixelHeight=MImg*aaa
16 if(i<20)setTimeout('max()',100)
17 }
18
19 //变小
20 function min(){
21 MImg=MainImg.style.pixelWidth-=i--
22 MainImg.style.pixelHeight=MImg*aaa
23 if(i>0)setTimeout('min()',100)
24 }
25
26 function init(){
27 aaa=MainImg.height/MainImg.width
28 MainImg.style.pixelWidth=85
29 MainImg.style.pixelHeight=55
30 }
31
32 onload=init
33 </script></body>
34 </html>
2 <head>
3 <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
4 <title>网页特效观止|www.jscode.cn| --- 鼠标放到图片上慢慢变大,移开后图片又慢慢变小</title>
5
6 </head>
7
8 <body>
9 <img id=MainImg onmouseover=max() onmouseout=min() src=http://www.jscode.cn/JsCode/images/flag.gif width="85" height="55">
10 <script>
11 var i=0
12 //变大
13 function max(){
14 MImg=MainImg.style.pixelWidth+=i++
15 MainImg.style.pixelHeight=MImg*aaa
16 if(i<20)setTimeout('max()',100)
17 }
18
19 //变小
20 function min(){
21 MImg=MainImg.style.pixelWidth-=i--
22 MainImg.style.pixelHeight=MImg*aaa
23 if(i>0)setTimeout('min()',100)
24 }
25
26 function init(){
27 aaa=MainImg.height/MainImg.width
28 MainImg.style.pixelWidth=85
29 MainImg.style.pixelHeight=55
30 }
31
32 onload=init
33 </script></body>
34 </html>