Javascript assistance in FP2003

T

threademporium

My website uses the web component ad banner found in FP2002. I know the
problems associated with new computers having the ability to view this today
and I am trying to find a Javascript to replicate some of the capability.

The Javascript below is working for me in that it does what I want but I am
unable to have more tha one set of rotating picture sets on any one page of
my website. as sson as I copy and paste the script into the page code for the
second time both the new and the first rotating picture set stops cycling
through and displats a fixed image.
I am a novice at anything to with web creation and thus far have worked
using design view in FP2003. If you have any advice for me in what I could do
to to fix this I need some idiot proof instructions as in ( open your mouth,
breathe in, count to 2, blow it out again, repeat for the next 75 years)

URL where you can see the script - go to this URL and look at the top
pictures titles bugle beads & straight beads. They will be stationary but
should be rotating to another picture automatically
http://www.habcraft.co.uk/beads.htm

Thanks for taking a look at my question
Dave
 
T

Trevor L.

threademporium said:
My website uses the web component ad banner found in FP2002. I know
the problems associated with new computers having the ability to view
this today and I am trying to find a Javascript to replicate some of
the capability.

The Javascript below is working for me in that it does what I want
but I am unable to have more tha one set of rotating picture sets on
any one page of my website. as sson as I copy and paste the script
into the page code for the second time both the new and the first
rotating picture set stops cycling through and displats a fixed image.
I am a novice at anything to with web creation and thus far have
worked using design view in FP2003. If you have any advice for me in
what I could do to to fix this I need some idiot proof instructions
as in ( open your mouth, breathe in, count to 2, blow it out again,
repeat for the next 75 years)

URL where you can see the script - go to this URL and look at the top
pictures titles bugle beads & straight beads. They will be stationary
but should be rotating to another picture automatically
http://www.habcraft.co.uk/beads.htm

Thanks for taking a look at my question
Dave

Wow, looks complex.

I found a simple (well, fairly simple script) that rotates 4 images in a
single position

The code in the body is
<body onload="rotateImage('rImage')">
<center>
<img name="rImage"
src="http://javascript.internet.com/img/image-cycler/01.jpg" width=120
height=90>
</center>

But you want more than one place in which to rotate images.

So I would set up more <img> tags in which to rotate them and call more than
one function onload
e.g.
<body onload="rotateImage('rImage');rotateImage2('rImage2')">
<center>
<img name="rImage"
src="http://javascript.internet.com/img/image-cycler/01.jpg" width=120
height=90>
<br>
<img name="rImage2"
src="http://javascript.internet.com/img/image-cycler/11.jpg" width=120
height=90>
</center>

You would need to have separate arrays for each and perhaps have separate
variables as indexes,
e.g. arrays image_list, image-list2,etc. with indexes image-index,
image-index2, etc and the length variables
var number_of_image = image_list.length
var number_of_image2 = image_list2.length
etc.
(See below)

Anyway, here is is for what it is worth
<html>
<head>

<!-- Original: Robert Bui ([email protected]) -->
<!-- Web Site: http://astrogate.virtualave.net -->

<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->

<script language="javascript">
var interval = 2.5; // delay between rotating images (in seconds)
var random_display = 1; // 0 = no, 1 = yes
interval *= 1000;

var image_index = 0;
image_list = new Array();
image_list[image_index++] = new
imageItem("http://javascript.internet.com/img/image-cycler/01.jpg");
image_list[image_index++] = new
imageItem("http://javascript.internet.com/img/image-cycler/02.jpg");
image_list[image_index++] = new
imageItem("http://javascript.internet.com/img/image-cycler/03.jpg");
image_list[image_index++] = new
imageItem("http://javascript.internet.com/img/image-cycler/04.jpg");
var number_of_image = image_list.length;

function imageItem(image_location) {
this.image_item = new Image();
this.image_item.src = image_location;
}

function get_ImageItemLocation(imageObj) {
return(imageObj.image_item.src)
}

function generate(x, y) {
var range = y - x + 1;
return Math.floor(Math.random() * range) + x;
}

function getNextImage() {
if (random_display) {
image_index = generate(0, number_of_image-1);
}
else {
image_index = (image_index+1) % number_of_image;
}
var new_image = get_ImageItemLocation(image_list[image_index]);
return(new_image);
}

function rotateImage(place) {
var new_image = getNextImage();
document[place].src = new_image;
document[place].title = 'image' + image_index
var recur_call = "rotateImage('"+place+"')";
setTimeout(recur_call, interval);
}
</script>
</head>
<body onload="rotateImage('rImage')">

<center>
<img name="rImage"
src="http://javascript.internet.com/img/image-cycler/01.jpg" width=120
height=90>
</center>

<p><center>
<font face="arial, helvetica" size="-2">Free JavaScripts provided<br>
by <a href="http://javascriptsource.com">The JavaScript Source</a></font>
</center><p>

</body>
</html>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top