@UR_MaximusApr 29.2005 — #I am not too sure if this will work. I usually use this code to do something similar however i used it for random quotes not pictures, however I am sure it would still work. Just replace the quote with the image source! maybe not! either way it is a cool piece of code.
<SCRIPT language=JavaScript>
<!-- Begin
var howMany = 4
var quote = new Array(howMany+1)
quote[0]="quote1"
quote[1]="quote2"
quote[2]="quote3"
quote[3]="quote4"
quote[4]="quote5"
quote[5]="quote6"
function rndnumber(){
var randscript = -1
while (randscript < 0 || randscript > howMany || isNaN(randscript)){
You’re going to need some sort of server-side processing instruction in order to do what you want. You could do it in JavaScript, but it would be inaccessible (not work for ~10% of your visitors). It’s also more elegant to avoid JavaScript when it is unnecessary. If you have access to a server-side language, such as Perl, PHP, or ASP, then you can use that. Do you know what server-side languages you have available?[/font]
@JonaApr 30.2005 — #[font=trebuchet ms]If you have PHP available, then you can try this.[/font]
[code=php] <?php $images = array("image1.gif", "image2.gif", "image3.gif"); $dir = "http://www.site.com/path/to/images/"; # No need to change anything past this line echo '<img src="'.($images[rand(0,count($images)-1)]).'" alt="">'; ?> [/code]
[font=trebuchet ms]With PHP, you can also make a script to take all the images in a directory (on your server, of course) and output one of them at random. That way, you’ll never even have to update the script; you just upload the new image that you want to randomly display, and the script will display it at random.[/font]