Random picture and link

Updated: 04/26/2017 by Computer Hope


The above banner is an example of a random picture. If you refresh or reload this page (press F5), you should get a different image. If you get the same picture, try again.

Source code

<script type="text/javascript">
//Javascript Created by Computerhope https://www.computerhope.com/
//store the quotations in arrays
var images = [],
index = 0;

images[0] = "<a href = 'https://www.computerhope.com/'><img src='https://www.computerhope.com/banners/banner.gif' alt='Visit Computer Hope'></a>";
images[1] = "<a href = 'https://www.computerhope.com/history'><img src='https://www.computerhope.com/banners/banner2.gif' alt='Computer History'></a>";
images[2] = "<a href = 'https://www.computerhope.com/'><img src='https://www.computerhope.com/banners/banner3.gif' alt='Visit Computer Hope'></a>";

index = Math.floor(Math.random() * images.length);

Additional information

  • See our JavaScript definition for further information and related links on this term.