Make your own free website on

Scripts | JavaScript Tutorials | JavaScript Reference | Applets | DHTML | Design | Freewarejava

spacer.gif (810 bytes)

Home / Free JavaScripts / Image Slideshows & Galleries / Here

JavaScript Kit

Cut & Paste Index It Image Slideshow

Credit: JavaScript Kit

Description: This user friendly image slideshow displays an index of all of the images, letting the viewer see the position of the current image within the slideshow, and jump to a particular image at will. It uses CSS for its overall appearance, allowing for easy customization. Cool!



Step 1: Insert the below CSS and script into the <HEAD> section of your page:

<style type="text/css">

width: 300px;
height: auto;

#numberDiv a{
font: bold 14px Arial;
text-decoration: none;

margin-top: 6px;


<script type="text/javascript">

// Index It Image Slideshow script- By
// For this and over 400+ free scripts, visit JavaScript Kit-
// This notice must stay intact for use

//Specify images for slideshow:
//["Image Path", "Optional Image link"]

var numberslide=new Array()
numberslide[0]=["plane1.gif", ""]
numberslide[1]=["plane2.gif", ""]
numberslide[2]=["plane3.gif", ""]
numberslide[3]=["plane4.gif", ""]
numberslide[4]=["plane5.gif", ""]

var mylinktarget="" //specify optional link target
var mylinkcolor="navy" //specify default color of number links
var mylinkcolorSelected="red" //specify color of selected links

var imgborderwidth=0 //specify border of image slideshow

/////Stop customizing here////////////////

var preloadit=new Array()
for (i=0;i<numberslide.length;i++){
preloadit[i]=new Image()

var currentindex=""

function changeslides(which){
var imghtml=""
currentindex=(which=="initial")? 0 : parseInt(which)
var mode=(which=="initial")? "initial" : ""
var which=(mode=="initial")? numberslide[0] : numberslide[which]
if (which[1]!="")
imghtml='<a href="'+which[1]+'" target="'+mylinktarget+'">'
imghtml+='<img src="'+which[0]+'" border="'+imgborderwidth+'">'
if (which[1]!="")

if (mode=="initial")

function createnumbers(){
document.write('<a href="javascript:changeslides(0)" style="color:'+mylinkcolorSelected+'">0</a> ')
for (i=1; i< numberslide.length; i++)
document.write('<a href="javascript:changeslides(\''+i+'\')">'+i+'</a> ')

function changecolors(){
var numberobj=document.getElementById("numberDiv")
for (i=0; i<=currentindex; i++)
for (i=currentindex+1; i<numberslide.length; i++)

function goforward(){
if (currentindex<numberslide.length-1)

function goback(){
if (currentindex!=0)



Step 2: Where you want the slideshow to appear on your page, add the below code:

<div id="slideshowContainer">

<div id="imagecontainer">
<script type="text/javascript">
changeslides("initial") //This call displays the first image

<div id="numberDiv">
<script type="text/javascript">
createnumbers() //This call writes out the numbers

<div id="backforthbuttons">
<a href="javascript:goforward()" style="float: right"><img src="blueright.gif" border="0"></a> <a href="javascript:goback()"><img src="blueleft.gif" border="0"></a>

<p style="font: normal 11px Arial">This free script provided by<br>
<a href="">JavaScript Kit</a></p>




You'll want to customize the CSS in Step 1, so the slideshow's width and height is set to snugly contain the largest image within your collection. Then, change the variables inside the script that follows based on the comments.

Copyright 1997-2006 JavaScript Kit. NO PART may be reproduced without author's permission.

CSS Library | JavaScript & DHTML Menus | CSS Drive  | Java Online Blackjack | Web hosting Search | Web Development | Cheap Printer Ink