Display random image in random position?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Display random image in random position?

Andy Mcshane
Hi all, I have a static web page that is to be used as a placeholder for a new site that I am developing. This holding page has some static text in the center of the page. I have been asked to continually display a random image in a random position everywhere around the center static text at short intervals with page reload. I would at first of thought that this would be better done in flash but as I have no idea how to use flash I cannot do it. Does anybody know if something like this can be done in javascript? If so any ideas where to find a script?

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:33:2419
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/33
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:33
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.33
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54
Reply | Threaded
Open this post in threaded view
|

Re: Display random image in random position?

felipevaldez
On 4/19/06, Andy Mcshane <[hidden email]> wrote:
>
> Hi all, I have a static web page that is to be used as a placeholder for a
> new site that I am developing. This holding page has some static text in the
> center of the page. I have been asked to continually display a random image
> in a random position everywhere around the center static text at short
> intervals with page reload. I would at first of thought that this would be
> better done in flash but as I have no idea how to use flash I cannot do it.
> Does anybody know if something like this can be done in javascript? If so
> any ideas where to find a script?


use google

[untested]
<img id=a>
<script>;document.getElementById('a').src="./images/image"+Math.abs(
Math.round(Math.random()*20))+".gif";</script>

assumes 20 images in a /images folder called
image0
image1
....
image20

hope it helps.


--
//f3l
http://www.geocities.com/kyoosho/


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:33:2420
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/33
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:33
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.33
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54