Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > Rotate imgs

Reply
Thread Tools

Rotate imgs

 
 
Fabri
Guest
Posts: n/a
 
      02-07-2005
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ù?)
 
Reply With Quote
 
 
 
 
Erwin Moller
Guest
Posts: n/a
 
      02-07-2005
Fabri wrote:

> 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.
>
>



hi,

Make a callbackfunction using setTimeout("somefunction", 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="somethingelse.gif";

Good luck.

Regards,
Erwin Moller
 
Reply With Quote
 
 
 
 
Evertjan.
Guest
Posts: n/a
 
      02-07-2005
Fabri wrote on 07 feb 2005 in comp.lang.javascript:

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


It is.

> <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:


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.getElementById("one")
var two = document.getElementById("two")
var three = document.getElementById("three")
var temp = one.src
one.src = two.src
two.src = three.src
three.src = temp
setTimeout('rotate()',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)

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
What is cause of a problem in IE6.0, not seeing imgs... shajnday HTML 19 08-08-2010 07:08 AM
PIL rotate : Rotate By Shear / Paeth Rotation? IanJSparks Python 0 01-10-2008 04:50 PM
Rotate the graphics without rotate the text in SVG RC XML 1 08-03-2006 07:45 AM
Need Preload+Mouseover code for 4 imgs Dave Javascript 1 09-03-2004 02:21 AM
IE cannot put padding on IMGs? delerious@no.spam.com HTML 17 12-25-2003 01:11 AM



Advertisments