[JavaScript] 让图片抖动的JS代码 →→→→→进入此内容的聊天室

来自 , 2019-10-16, 写在 JavaScript, 查看 159 次.
URL http://www.code666.cn/view/fb03a0f2
  1. <SCRIPT language=javascript1.2>  
  2. <!--  
  3. var rector=2  
  4. var stopit=0  
  5. var a=1  
  6. var count=0  
  7. function init(which){  
  8. stopit=0  
  9. shake=which  
  10. shake.style.left=0  
  11. shake.style.top=0  
  12. }  
  13. function rattleimage(){  
  14. if ((!document.all&&!document.getElementById)||stopit==1||count==100)  
  15. return  
  16. count++  
  17. if (a==1){  
  18. shake.style.top=parseInt(shake.style.top)+rector  
  19. }  
  20. else if (a==2){  
  21. shake.style.left=parseInt(shake.style.left)+rector  
  22. }  
  23. else if (a==3){  
  24. shake.style.top=parseInt(shake.style.top)-rector  
  25. }  
  26. else{  
  27. shake.style.left=parseInt(shake.style.left)-rector  
  28. }  
  29. if (a<4)  
  30. a++  
  31. else  
  32. a=1  
  33. setTimeout("rattleimage()",50)  
  34. }  
  35. function stoprattle(which){  
  36. stopit=1  
  37. count=0  
  38. which.style.left=0  
  39. which.style.top=0  
  40. }  
  41. //-->  
  42. </SCRIPT>  
  43. <style>.shakeimage {POSITION: relative}  
  44. </style>  
  45. <img src="图片的路径" onmouseout=stoprattle(this) onmouseover=init(this);rattleimage() class=shakeimage>
  46. //javascript/4901

回复 "让图片抖动的JS代码"

这儿你可以回复上面这条便签

captcha