努力学习 Java

知之者不如好之者,好之者不如乐之者,乐之者不如痴之者

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

<html>
<head>
<title>鼠标放到图片上慢慢变大,移开后图片又慢慢变小  </title>
<meta http-equiv="Content-Type" content="text/html;charset=gb2312">
</head>
<body>
<img id="MyImg" onmouseover="max()" onmouseout="min()"
src="pic.jpg" width="80" height="60">

<script>

var  i = 0  
var  id1, id2 ;


function  max() {
 clearTimeout(id2) ;  
// 必须清除,不然图象会抖动
 nLong  =  MyImg.style.pixelWidth  +=  i ++  
 MyImg.style.pixelHeight 
=  nLong * aaa 
 
if  (i < 20 ) id1 = setTimeout('max()',  100 );
}

function  min()  {
 clearTimeout(id1) ;   
// //必须清除,不然图象会抖动
 nLong  =  MyImg.style.pixelWidth  -=   --
 MyImg.style.pixelHeight 
=  nLong * aaa 
 
if  (i > 0 ) id2 = setTimeout('min()',  100
}


function  init()  {
 aaa 
=  MyImg.height / MyImg.width 
 MyImg.style.pixelWidth 
=   80
 MyImg.style.pixelHeight 
=   60  
}


onload 
=  init  // init 不能有括号,不能有引号;等效于<body onload ="init()"> 

</script>

</body>
</html>

posted on 2006-07-05 14:52 飞仙 阅读(637) 评论(0)  编辑  收藏 所属分类: Javascript


只有注册用户登录后才能发表评论。


网站导航: