Javascript play/stop in gallery

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • louisaivy
    New Member
    • Oct 2011
    • 1

    Javascript play/stop in gallery

    Hi all i am having trouble with my play and stop buttons in my javascript gallery. When you first load the gallery and try and play the gallery you first have to press stop before you can press play, does any body have any idea as why this may be? I have tried to change the

    Code:
    document.getElementById("play").disabled="disabled";
    document.getElementById("stop").disabled="";

    to true and false but this doesn't seem to work, instead the buttons stop working all together.


    Code:
    var i = 0, imageSorce = new Array(), preload = new Array();//add an array to cycle through the images
    imageSorce[0]="Assets/images/big/0.jpg";
    imageSorce[1]="Assets/images/big/1.jpg";
    imageSorce[2]="Assets/images/big/2.jpg";
    imageSorce[3]="Assets/images/big/3.jpg";
    imageSorce[4]="Assets/images/big/4.jpg";
    imageSorce[5]="Assets/images/big/5.jpg";
    imageSorce[6]="Assets/images/big/6.jpg";
    imageSorce[7]="Assets/images/big/7.jpg";
    
    for (var j=0; j<imageSorce.length;j++)
    {
    preload[j] = new Image;
    preload[j].src = imageSorce[j];
    
    }
    function mode(param)
    {
    smode=param;
    }
    
    function startSlideshow()//as the name suggests it starts the slideshow when play is clicked.
    {
    if(smode=="play")
    {
    document.getElementById("play").disabled="disabled";
    document.getElementById("stop").disabled="";
    document.getElementById("slide").src=imageSorce[i];
    document.getElementById('captionarea').innerHTML=caption[i];//adds captions when the gallery is played.
    
    i++;
    setTimeout("startSlideshow()",3000);
    
    }
    
    else if(smode=="stop")
    {
    document.getElementById("stop").disabled="disabled";
    document.getElementById("play").disabled="";
    document.getElementById("play").value="";
    
    }
    if(i==imageSorce.length)
    {
    i=0;
    
    }
    }
    can anybody help me figure this out?
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    Make sure stop is initially disabled. Also, could you post the corresponding HTML code?

    Comment

    Working...