TShopping

標題: 圖片震動 [打印本頁]

作者: woff    時間: 2010-1-22 00:37
標題: 圖片震動

  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>
複製代碼





歡迎光臨 TShopping (http://www.tshopping.com.tw/) Powered by Discuz! X3.2