中关村村草 发表于 2012-01-10 23:30

鼠标移至图片后抖动的JS代码

鼠标移至图片后抖动的JS代码




代码简介:

仿QQ的窗口抖动特效,鼠标移到到图片上面,图片就开始疯狂的抖动,好像对你的鼠标过敏一样,比较有意思,有会你的网页增加了修改功能。

代码内容:

View Code<html><head><title>鼠标移至图片后抖动的JS代码 - www.webdm.cn</title></head><BODY><style>.shakeimage{position:relative}</style><img src=http://www.webdm.cn/images/wall1_s.jpg class="shakeimage" onMouseover="init(this);rattleimage()" onMouseout="stoprattle(this)"><script language="JavaScript1.2">var rector=3var stopit=0 var a=1function init(which){stopit=0shake=whichshake.style.left=0shake.style.top=0}function rattleimage(){if ((!document.all && !document.getElementById)||stopit==1)returnif (a==1){shake.style.top=parseInt(shake.style.top)+rector}else if (a==2){shake.style.left=parseInt(shake.style.left)+rector}else if (a==3){shake.style.top=parseInt(shake.style.top)-rector}else{shake.style.left=parseInt(shake.style.left)-rector}if (a<4)a++elsea=1setTimeout("rattleimage()",50)}function stoprattle(which){stopit=1which.style.left=0which.style.top=0}</script></body></html><br /><p><a href="http://www.webdm.cn">网页代码站</a> - 最专业的网页代码下载网站 - 致力为中国站长提供有质量的网页代码!</p>
复制代码

健康木乃伊 发表于 2012-01-10 23:30

谢谢分享
页: [1]
查看完整版本: 鼠标移至图片后抖动的JS代码