找回密碼
 註冊
搜索
查看: 2085|回復: 1

[教學] 圖片震動

[複製鏈接]
發表於 2010-1-22 00:37:03 | 顯示全部樓層 |閱讀模式
 
Push to Facebook

  1. <style>
  2. .shakeimage{
  3. position:relative
  4. }
  5. </style>
  6. <script language="圖片網此">

  7. var rector=10

  8. var stopit=0
  9. var a=1

  10. function init(which){
  11. stopit=0
  12. shake=which
  13. shake.style.left=0
  14. shake.style.top=0
  15. }

  16. function rattleimage(){
  17. if ((!document.all&&!document.getElementById)||stopit==1)
  18. return
  19. if (a==1){
  20. shake.style.top=parseInt(shake.style.top)+rector
  21. }
  22. else if (a==2){
  23. shake.style.left=parseInt(shake.style.left)+rector
  24. }
  25. else if (a==3){
  26. shake.style.top=parseInt(shake.style.top)-rector
  27. }
  28. else{
  29. shake.style.left=parseInt(shake.style.left)-rector
  30. }
  31. if (a<4)
  32. a++
  33. else
  34. a=1
  35. setTimeout("rattleimage()",50)
  36. }

  37. function stoprattle(which){
  38. stopit=1
  39. which.style.left=0
  40. which.style.top=0
  41. }

  42. </script>
複製代碼
 
您需要登錄後才可以回帖 登錄 | 註冊

本版積分規則

Archiver|手機版|小黑屋|TShopping

GMT+8, 2025-4-30 22:49 , Processed in 0.020065 second(s), 17 queries .

Powered by Discuz! X3.5

© 2001-2025 Discuz! Team.

快速回復 返回頂部 返回列表