1. Home
  2. Computing & Technology
  3. JavaScript

Unobtrusive Random Images

2. Obtain the Script

More of this Feature

Example Add to Your Page

The first thing you need to do to be able to use my random images script is to copy the following JavaScript and save it as randimg.js.

We'll add code to this afterwards to actually create the image array(s) and attach them to the page (or you can set that up in a separate script if you prefer).

You next attach the script into your web page that you wish to display your random images on by adding the following code into the head section of your page.

<script type="text/javascript" src="randimg.js">
</script>

The next step is to add the code to your page that determines where you want the images to appear.

Explore JavaScript
About.com Special Features

The Best Web Trends of the Decade

A look back at the best innovations, ideas and technologies over the last 10 years, More >

Family Tech Center

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

  1. Home
  2. Computing & Technology
  3. JavaScript

©2009 About.com, a part of The New York Times Company.

All rights reserved.