Rotate imgs

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Fabri

    #1

    Rotate imgs

    I wonder if it is possible to rotate these images in this way:



    <img name="one" src="one.gif">
    <img name="two" src="two.gif">
    <img name="three" src="three.gif" >

    I would like every 3 (or 4, 5...) seconds to appear 3 gif another way:

    first loop:

    1-2-3

    second loop:

    1-3-2

    third loop:

    2-1-3

    fourth loop:

    2-3-1

    and so on...

    Any help much appreciated.

    Best regards.


    --
    Fabri
    (Lattepiù, chi può darti di più?)
  • Erwin Moller

    #2
    Re: Rotate imgs

    Fabri wrote:
    [color=blue]
    > I wonder if it is possible to rotate these images in this way:
    >
    >
    >
    > <img name="one" src="one.gif">
    > <img name="two" src="two.gif">
    > <img name="three" src="three.gif" >
    >
    > I would like every 3 (or 4, 5...) seconds to appear 3 gif another way:
    >
    > first loop:
    >
    > 1-2-3
    >
    > second loop:
    >
    > 1-3-2
    >
    > third loop:
    >
    > 2-1-3
    >
    > fourth loop:
    >
    > 2-3-1
    >
    > and so on...
    >
    > Any help much appreciated.
    >
    > Best regards.
    >
    >[/color]


    hi,

    Make a callbackfunctio n using setTimeout("som efunction", time).
    You set a function and the time that should elapse.
    (Look it up.)
    Then let that function end with another setTimeout().

    You can change the src of an image like:
    document.images["one"].src="something else.gif";

    Good luck.

    Regards,
    Erwin Moller

    Comment

    • Evertjan.

      #3
      Re: Rotate imgs

      Fabri wrote on 07 feb 2005 in comp.lang.javas cript:
      [color=blue]
      > I wonder if it is possible to rotate these images in this way:[/color]

      It is.
      [color=blue]
      > <img name="one" src="one.gif">
      > <img name="two" src="two.gif">
      > <img name="three" src="three.gif" >
      >
      > I would like every 3 (or 4, 5...) seconds to appear 3 gif another way:[/color]

      I suppose you want the a script?
      Next time please try it yourself first, you will learn from it.

      =============

      <script type='text/javascript'>
      function rotate() {
      var one = document.getEle mentById("one")
      var two = document.getEle mentById("two")
      var three = document.getEle mentById("three ")
      var temp = one.src
      one.src = two.src
      two.src = three.src
      three.src = temp
      setTimeout('rot ate()',3000)
      }
      </script>

      <body onload='rotate( )'>

      <img id="one" src="one.gif">
      <img id="two" src="two.gif">
      <img id="three" src="three.gif" >

      --
      Evertjan.
      The Netherlands.
      (Replace all crosses with dots in my emailaddress)

      Comment

      Working...