Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Jun 2007
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    javaScript Slideshow

    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>

  • #2
    Senior Coder
    Join Date
    Aug 2002
    Location
    UK
    Posts
    2,789
    Thanks
    2
    Thanked 14 Times in 14 Posts
    Here's one possibility

    PHP Code:
    <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=
    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> 
    Last edited by Mr J; 06-08-2007 at 08:05 PM.
    The silent one.

    The most dangerous thing in the world is an idea.
    The most dangerous person in the world is the one with an idea.

  • #3
    New to the CF scene
    Join Date
    Jun 2007
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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!!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •