By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,945 Members | 1,354 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,945 IT Pros & Developers. It's quick & easy.

Rotate imgs

P: n/a
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ù?)
Jul 23 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
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
Jul 23 '05 #2

P: n/a
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)

Jul 23 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.