代码简介:
仿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>
代码来自:http://www.webdm.cn/webcode/1c36fac4-9137-4d1e-ad8e-028e3fa8effb.html
来源:https://www.cnblogs.com/webdm/archive/2012/01/09/2316902.html