Hard Light Productions Forums

Off-Topic Discussion => General Discussion => Topic started by: Fineus on September 02, 2003, 01:04:44 pm

Title: An HTML / Random Image Display Question...
Post by: Fineus on September 02, 2003, 01:04:44 pm
Hail all,

I'll cut to the chase. I need a piece of code that will select (at random) an image from a folder online, and display that image in the location where the code is placed on the web page. This is for background graphics - nothing interactive. I believe an example exists in VolitionWatchs random ship image selection on FSWatches banner graphic.
Title: An HTML / Random Image Display Question...
Post by: Galemp on September 02, 2003, 02:15:45 pm
Inferno's main page does something like that. Ask them.
Title: An HTML / Random Image Display Question...
Post by: Fineus on September 02, 2003, 02:23:17 pm
Say, that might just be the trick... Inferno guys - mind if I shamelessly rip that javascript from your source? I can provide kudos for its creation if need be :)

Edit: I'm forgetting myself, cheers GE!
Title: An HTML / Random Image Display Question...
Post by: Charlotte on September 02, 2003, 02:30:29 pm
Obviously not made by me so I won't take credit but here:

EDIT- I can't post the code caause HTML is on... :doubt:

EDIT2- Sent it through PM and it seems to work through PM :)
Title: An HTML / Random Image Display Question...
Post by: Fineus on September 02, 2003, 02:33:19 pm
Just use the code tags:

[*code] [*/code]
Title: An HTML / Random Image Display Question...
Post by: Charlotte on September 02, 2003, 02:35:07 pm
I did, it didn't show up here. Well, you should have it through PM anyhow ;)
Title: An HTML / Random Image Display Question...
Post by: Stealth on September 02, 2003, 04:12:51 pm
http://www.icglink.net/cgi-bin/icglink/helpdesk/kb.cgi?view=28

http://www.logicscripts.com/products/randomimage/

http://www.scriptarchive.com/ssi_image.html
Title: An HTML / Random Image Display Question...
Post by: Stealth on September 02, 2003, 04:17:42 pm




unfortunately i can't take credit for the one below, although i can't take 100% credit for the one above, i did revise it a little ;) :D.  the one below seems to work a lot better though :p :doubt:





if you want a really good one i guess i could program one from scratch, but that'd take a long time and only if you don't find one that you like. (which you'd better :D)
Title: An HTML / Random Image Display Question...
Post by: Zeronet on September 02, 2003, 04:19:12 pm
Could use a monkey.
Title: An HTML / Random Image Display Question...
Post by: Xelion on September 03, 2003, 07:26:05 am
I REPEAT THIS IS NOT PHP BUT JAVASCRIPT!
Damn Forum Code :hopping:

This can either go in an external .js (javascript) file or can be placed in the head section of the document.





Put the script below into the body section of your html document




This should be pretty straight forward... if it isn't I'll talk to u on ICQ and answer any queries you have..., just one thing though: RandInt(2) & (Math.random()*2) >> the 2 refers to the amount of images there are (in programming they start from 0 hence there are three images...you will have to edit this number if there are more or less images!)

I don't want any credit for this script...absolutely none :nod: :D
Title: An HTML / Random Image Display Question...
Post by: J.F.K. on September 03, 2003, 09:17:49 am
I always wondered how sites did that, I assumed it was scripted or something. High funkiness. :)
Title: An HTML / Random Image Display Question...
Post by: Woolie Wool on September 03, 2003, 09:53:14 am
Quote
Originally posted by Zeronet
Could use a monkey.


What is it with you and monkeys?
Title: An HTML / Random Image Display Question...
Post by: Stealth on September 03, 2003, 05:52:18 pm
yeah the one Max posted seems to be the best :)