PDA

View Full Version : Setting time delay for image load


Reno CF
05-15-2003, 04:21 PM
I recently found a nice script that loads images sequentially into a space, like a slideshow but without the advance button. However it does not have a variable that I can set for the amount of time between image loads, and I'm wondering if that can be added? If there is a line of js that I can include to accomplish that, I think it would help:

Here is the script in question:

<script type="text/javascript">
<!--

// Set to appropriate image name.
var image="";
// Set to appropriate URL
var destination="";

// Sequential Image/Link determining function.
function sequentialLoad()
{
// Keep seq_number within correct range
if (parent.seq_number>7)
parent.seq_number=1;

// Set variable image equal to appropriate image file name & URL.
if (parent.seq_number==1)
{
destination="foo_1.html";
image="image1.gif";
}
if (parent.seq_number==2)
{
destination="foo_2.html";
image="image2.gif";
}
if (parent.seq_number==3)
{
destination="foo_3.html";
image="image3.gif";
}
if (parent.seq_number==4)
{
destination="foo_4.htm";
image="image4.gif";
}
if (parent.seq_number==5)
{
destination="foo_5.htm";
image="image5.gif";
}
if (parent.seq_number==6)
{
destination="foo_6.htm";
image="image6.gif";
}
if (parent.seq_number==7)
{
destination="foo_7.htm";
image="image7.gif";
}

parent.seq_number++;
}

// -->
</SCRIPT>
</head>

<BODY>
<script type="text/javascript">
<!--
sequentialLoad()

// Open document for writing.
document.open();

document.write("<CENTER><A HREF='"+destination+"' TARGET='frame3'><IMG SRC="+image+" WIDTH=50 HEIGHT=50 BORDER=0></A></CENTER>");

// -->
</SCRIPT>

Mr J
05-15-2003, 09:09 PM
Unless I am missing something here this script will only show 1 image.

There is no statement for loading the other images

Take a look here for a slideshow

www.huntingground.freeserve.co.uk/style/sldshow.htm

It has the following:

A transitional effect to show images.

Each image can be linked to a URL

Each image can have a text message

Continuous loop through all images or run all images once

Delay between each image

Reno CF
05-15-2003, 09:48 PM
Thanks Mr J -- what a great script! The one I referenced I originally saw listed at one of the free js sites (TotalScripts.com I believe), and when I clicked the link, this page opened:

http://www.essex1.com/people/timothy/js-seq1.htm

On that page, the method to copy the coding leaves a lot to be desired, so I may have missed something...