...

View Full Version : javaScript Slideshow



fourtsr
06-08-2007, 05:37 PM
Hello,

Ok I am way over my head here, real newbie!!!, I am trying to create a web page that contains 2 slide shows on each corner of the page i inserted the javascript slide show script twice on the page with different photos on each source but only one works. below is the code. I know this is a really stupid and shows my ignorance but if any of you can help by telling me how to acomplish this I would overnight my firstborn to you (he really dosent do much around the house anyway)

<SCRIPT LANGUAGE="JavaScript">
<!--

/*
Script by FPMC at http://jsarchive.8m.com
Submitted to JavaScript Kit (http://javascriptkit.com)
For this and 400+ free scripts, visit http://javascriptkit.com
*/

//set image paths
src = ["image1.gif", "image2.gif", "image3.gif", "image4.gif"]


//set corresponding urls
url = ["http://freewarejava.com", "http://javascriptkit.com", "http://dynamicdrive.com", "http://www.geocities.com"]

//set duration for each image
duration = 4;

//Please do not edit below
ads=[]; ct=0;
function switchAd() {
var n=(ct+1)%src.length;
if (ads[n] && (ads[n].complete || ads[n].complete==null)) {
document["Ad_Image"].src = ads[ct=n].src;
}
ads[n=(ct+1)%src.length] = new Image;
ads[n].src = src[n];
setTimeout("switchAd()",duration*1000);
}
function doLink(){
location.href = url[ct];
} onload = function(){
if (document.images)
switchAd();
}
//-->
</SCRIPT>

<A HREF="javascript:doLink();" onMouseOver="status=url[ct];return true;"
onMouseOut="status=''">
<IMG NAME="Ad_Image" SRC="image1.gif" BORDER=0>
</A>

<p align="center"><font face="arial" size="-2">This free script provided by <a href="http://javascriptkit.com">JavaScript Kit</a></font></p>

Mr J
06-08-2007, 08:52 PM
Here's one possibility


<HTML>
<HEAD>
<TITLE>Slideshow - Multiple Slides</TITLE>

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

var slider1=new newSlider('display1',2000) // img id, speed in milliseconds
slider1Array=new Array("pic1.jpg","pic2.jpg","pic3.jpg","pic4.jpg")

var slider2=new newSlider('display2',4000)
slider2Array=new Array("pic5.jpg","pic6.jpg","pic7.jpg","pic8.jpg")

function newSlider(id,speed){
var count=0
var running=0
var timer=null

this.nextSlide=function(n){
running=1

document.getElementById(id).src=window[n+"Array"][count]

count++

if(count==window[n+"Array"].length){
count=0
}

timer = setTimeout(n+".nextSlide('"+n+"')",speed)

}

}

function initMslides(){

c=1
while(document.getElementById("display"+c)){
window["slider"+c].nextSlide('slider'+c)
c++
}

}
//-->
</script>

</HEAD>
<BODY onload="initMslides()">

<img id="display1" style="width:200px;height:125px">

<img id="display2" style="width:200px;height:125px">


</BODY>
</HTML>

fourtsr
06-08-2007, 10:03 PM
Thanks so much Mr. J !!!!

Thant worked just fine. Where would you like the kid sent. I can only afford ups ground. ;- ) .

Also, I am assuming that I can copy the var slider=new slider line if I would need to have more picts running.


Thanks so much again!!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum