http://oxtag.com/html/ex/ex/ex6.html

  1. <SCRIPT LANGUAGE="JavaScript">
  2. <!--
  3. delay=300        // 이미지가 바뀌는 시간 1000 = 1초, 이미지대신 스타일시트를 이용하면 무지 버벅이겠죠...ㅋ
  4. num = 1        // 파일 시작 번호.
  5. my_img = new Array()
  6. for(i=1;i<=8;i++) {
  7.     my_img[i] = new Image()
  8.     my_img[i].src = "http://oxtag.com/html/img/fish/fish_"+i+".gif"
  9. }
  10. function ani() {
  11.      ani_img.src = my_img[num].src
  12.      ani_loop = setTimeout('ani()',delay)
  13.          num = num + 1
  14.          if (num > 8) num = 1
  15. }
  16. function ani_stop() {
  17.     clearTimeout(ani_loop)
  18. }
  19. //-->
  20. </SCRIPT>
  21. </HEAD>
  22. <BODY>
  23. <!--
  24. 문서가 로드 되었을때 실행시킬경우
  25. <BODY onload=ani()>
  26. -->
  27. <center>
  28. <img src='http://oxtag.com/html/img/fish/fish_1.gif' name='ani_img' width=50 height=30>
  29. <p>
  30. <button style="border:1 solid #add8e6;background-color:white;" onClick="ani()" >animation start</button>
  31. <button style="border:1 solid #add8e6;background-color:white;" onClick="ani_stop()">animation stop</button>
  32. </center>
Posted by 알 수 없는 사용자
,