Is anyone good with Java?

Discussion in 'Web Design & Coding' started by spike228, Aug 26, 2009.

  1. spike228

    spike228 ST 38 VIP Member

    Joined:
    Jul 18, 2004
    Messages:
    2,256
    Likes Received:
    18
    Location:
    Honolulu, Hawaii
    I am working on this website: www.lefetuao.com

    On the home page, you will see a slideshow that I just updated. Previously, I had a much simpler slideshow that auto started, without the controls on the bottom. Adding those controls made the code much more complicated and eliminated the auto start feature.

    I've dug though the code a bit and I'm not sure what to change in order to enable auto start. I actually don't know Java so my programing logic is all from C, C++ and HTML.

    Can anyone help?

    Here is the code found in the head:
    Code:
    <SCRIPT LANGUAGE="JavaScript">
    
    <!-- Begin
    
    slides = new Array();
    
    slides[0] = ["/img/slideshow/float400.jpg", "/img/slideshow/float.JPG", "Photo: Float Competition: Le Fetuao Samoan Language School won 1st place!", "Float Competition: Le Fetuao Samoan Language School won 1st place!"];
    slides[1] = ["/img/slideshow/slide1.JPG", "/img/slideshow/slide1.JPG", "Photo: Le Fetuao Samoan Language School", " "];
    slides[2] = ["/img/slideshow/slide2.JPG", "/img/slideshow/slide2.JPG", "Photo: Le Fetuao Samoan Language School", " "];
    slides[3] = ["/img/slideshow/slide3.JPG", "/img/slideshow/slide3.JPG", "Photo: Le Fetuao Samoan Language School", " "];
    slides[4] = ["/img/slideshow/slide4.JPG", "/img/slideshow/slide4.JPG", "Photo: Le Fetuao Samoan Language School", " "];
    slides[5] = ["/img/slideshow/slide5.JPG", "/img/slideshow/slide5.JPG", "Photo: Le Fetuao Samoan Language School", " "];
    slides[6] = ["/img/slideshow/slide6.JPG", "/img/slideshow/slide6.JPG", "Photo: Le Fetuao Samoan Language School", " "];
    slides[7] = ["/img/slideshow/slide7.JPG", "/img/slideshow/slide7.JPG", "Photo: Le Fetuao Samoan Language School", " "];
    slides[8] = ["/img/slideshow/slide8.JPG", "/img/slideshow/slide8.JPG", "Photo: Le Fetuao Samoan Language School", " "];
    slides[9] = ["/img/slideshow/slide9.JPG", "/img/slideshow/slide9.JPG", "Photo: Le Fetuao Samoan Language School", " "];
    slides[10] = ["/img/slideshow/slide10.JPG", "/img/slideshow/slide10.JPG", "Photo: Le Fetuao Samoan Language School", " "];
    
    S = new Array();
    for (a=0; a < slides.length; a++) {
        S[a] = new Image(); S[a].src = slides[a][0][0];
    }
    var ImgNum = 0;
    var ImgLength = slides.length - 1;
    
    //Time delay between Slides in milliseconds
    var delay = 3000;
    var lock = false;
    var run;
    
    function chgImg(direction) {
      if (document.images) {
        ImgNum = ImgNum + direction;
      if (ImgNum > ImgLength) {
        ImgNum = 0;
      }
      if (ImgNum < 0) {
        ImgNum = ImgLength;
      }
      document.getElementById("slideshow").src = slides[ImgNum][0];
      document.getElementById("link").href = slides[ImgNum][1];
      document.getElementById("slideshow").alt = slides[ImgNum][2];
      document.getElementById("label").innerHTML = slides[ImgNum][3];
      }
    }
    function auto() {
      if (lock == true) {
      lock = false;
      window.clearInterval(run);
      }
      else if (lock == false) {
      lock = true;
      run = setInterval("chgImg(1)", delay);
      }
    }
    //  End -->
    </script>

    Thanks!
     
    spike228, Aug 26, 2009
    #1
    1. Advertisements

  2. spike228

    clifford VIP Member

    Joined:
    Jul 8, 2009
    Messages:
    184
    Likes Received:
    11
    Hi spike228

    I looked over your code and I see where you are
    starting the setInterval and clearInterval

    What I dont see is how you are calling the Auto Function

    Are you calling the Auto Function through a button or the onload event in the body tag
     
    clifford, Aug 26, 2009
    #2
    spike228 likes this.
    1. Advertisements

  3. spike228

    spike228 ST 38 VIP Member

    Joined:
    Jul 18, 2004
    Messages:
    2,256
    Likes Received:
    18
    Location:
    Honolulu, Hawaii
    Ohh thanks! I just realized that I had to call the auto function in the body tag. It was a little too early. :)
     
    spike228, Aug 27, 2009
    #3
  4. spike228

    clifford VIP Member

    Joined:
    Jul 8, 2009
    Messages:
    184
    Likes Received:
    11
    Did that get you going Spike?
     
    clifford, Aug 28, 2009
    #4
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.