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 2 of 2

Thread: java slide show

  1. #1
    CJN
    CJN is offline
    New to the CF scene
    Join Date
    Sep 2013
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Smile java slide show

    Hello, Maybe someone will help me to make underneath clickable slide show also an automatic slide show?
    Tank you much.

    Code:
    <script language=javascript>
    
    for(var j = 0; j < imgAr1.length; j++)
    {
    		rImg1[j] = new Image();
                rImg1[j].src = imgAr1[j];
    }
    
    document.onload = setting();
    
    var slide;
    function setting()
    {
    	slide = document.getElementById('pic');
    	slide.src = imgAr1[0];
    	slide.setAttribute("width",width);
    	slide.setAttribute("height",height);
    }
    
    //Image or picture slide show using java script
    //slideshow function
    var picture = 0;
    function slideshow(){
    	if(picture < imgAr1.length-1){
    		picture=picture+1;
    		slide.src = imgAr1[picture];
    	}
    }
    
    function prev(){
    	if(picture > 0){
    		picture=picture-1;
    		slide.src = imgAr1[picture];
    	}
    }
    
    function start(){
    		slide.src = imgAr1[0];
    		picture = 0;
    }
    
    function end(){
    		slide.src = imgAr1[imgAr1.length-1];
    		picture = imgAr1.length-1
    }
    </script>
    Last edited by VIPStephan; 09-02-2013 at 10:30 PM. Reason: fixed code BB tag

  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    17,733
    Thanks
    202
    Thanked 2,508 Times in 2,486 Posts
    Be aware that Java and Javascript are entirely different programming languages, in spite of the confusingly similar names. Rather like Austria and Australia!

    For a number of excellent slide show scripts see http://www.vicsjavascripts.org.uk/

    All the code given in this post has been tested and is intended to address the question asked.
    Unless stated otherwise it is not just a demonstration.


  •  

    Posting Permissions

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