Random Image | JavaScriptSource

Random Image

John Able Jun 22, 2001
Use this script to randomly display a different image each time the page is visited. Refresh this page and notice the image below will change. Any number of images can be used, and set-up is very easy.

The JavaScript Source: Miscellaneous: Random Image

Simply click inside the window below, use your cursor to highlight the script, and copy (type Control-c or Apple-c) the script into a new file in your text editor (such as Note Pad or Simple Text) and save (Control-s or Command-s). The script is yours!!!


Did you use this script?  Do you like this site?  Please link to us!

Leave a Response


I am using the random image code you have on your site, but I need the images to be responsive. Is there a way?

lynnlaclef Aug 7, 2015

thank you for the script for random image display

robert ridlay Apr 17, 2013

Nice for me....

umesh Apr 3, 2013

This script is working very well on my webpage except that every time the image changes the screen flickers. Can you recommend a solution? Thank you!

Christine Krebs Aug 2, 2012

love that this worked, but want the random image as the background. How do I specify that within the code?

Pamela Jul 24, 2012