Results 1 to 4 of 4

Thread: My Slide Show

  1. #1
    Join Date
    Oct 2009
    Posts
    38
    Thanks
    6
    Thanked 2 Times in 2 Posts

    Smile My Slide Show

    i believe you can't make a slideshow without javascript (unfortunately)!!
    you can use this function in "<script></script>":

    var t=setTimeout('photos[0]',2000);
    var current=0;

    function photos(img) {
    document.getElementById('main_img').src=images[img];
    current=img+1;
    if(current>4) current=0;
    timer=setTimeout('photos(current)',2000);
    }

    of course you must have your photos in an array...

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    tpravioti, that code won't work no matter what you add to it.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Oct 2009
    Posts
    38
    Thanks
    6
    Thanked 2 Times in 2 Posts

    Default

    tak a look at this..
    Code:
    <html>
    <head>
    <h3 align="center"><b>Photogallery</b></h3>
    </head>
    
    <body>
    <center>
    <img src="http://www.freeiconsdownload.com/site-images/Large/Delicious-Fruits-452.jpg" id="main_img" width="400" height="370"/>
    
    <table><tr>
    <td><img src="http://thumbs.dreamstime.com/thumb_235/1202513581PVn24j.jpg" width="75" height="75" onclick="photos(0);" style="cursor: pointer"/></td>
    <td><img src="http://www.medindia.net/healthnetwork/images/uploaded-photos/1_93.jpg" width="75" height="75" onclick="photos(1);" style="cursor: pointer"/></td>
    <td><img src="http://www.igourmet.com/images/new_landing/fruits-and-vegetables.jpg" width="75" height="75" onclick="photos(2);" style="cursor: pointer"/></td>
    <td><img src="http://lh4.ggpht.com/_gKQKwLZ8XUs/Sbwga37kASI/AAAAAAAAAY8/uEJGqqKB-UY/s800/10-Least-Toxic-Conventionally-Grown-Fruits-and-Vegetables-kiwi-banana.jpg" width="75" height="75" onclick="photos(3);" style="cursor: pointer"/></td>
    <td><img src="http://www.public-domain-photos.com/free-stock-photos-4-big/food/fruits-and-vegetables.jpg" width="75" height="75" onclick="photos(4);" style="cursor: pointer"/></td>
    </tr></table>
    
    <script>
    
    var images=[];
    images[0]="http://thumbs.dreamstime.com/thumb_235/1202513581PVn24j.jpg";
    images[1]="http://www.medindia.net/healthnetwork/images/uploaded-photos/1_93.jpg";
    images[2]="http://www.igourmet.com/images/new_landing/fruits-and-vegetables.jpg";
    images[3]="http://lh4.ggpht.com/_gKQKwLZ8XUs/Sbwga37kASI/AAAAAAAAAY8/uEJGqqKB-UY/s800/10-Least-Toxic-Conventionally-Grown-Fruits-and-Vegetables-kiwi-banana.jpg";
    images[4]="http://www.public-domain-photos.com/free-stock-photos-4-big/food/fruits-and-vegetables.jpg";
    
    var t=setTimeout('slideshow[0]',2000);
    var current=0;
    
    function slideshow(img) {
    	document.getElementById('main_img').src=images[img];
    	document.getElementById('imgcnt').value=(img+1)+' from '+images.length;
    	current=img+1;
    	if(current>4) current=0;
    	timer=setTimeout('slideshow(current)',2000);
    }
    
    function photos(img) {
    	document.getElementById('main_img').src=images[img];
    }
    
    </script>
    
    <input type="button" value="Start" onclick="setTimeout('slideshow(current)',2000);">&nbsp;&nbsp;
    <input type="text" value"1 from 5" id="imgcnt">&nbsp;&nbsp;
    <input type="button" value="Stop" onclick="clearTimeout(timer);">
    
    </center>
    </body>
    </html>
    it was my first gallery with slideshow!!hope it helps!!
    Last edited by Snookerman; 01-08-2010 at 03:47 PM. Reason: please use [CODE][/CODE] tags

  4. #4
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    I don't see how this line will work:

    Code:
    var t=setTimeout('slideshow[0]',2000);
    That's not (with the square brackets) a function call. I'm sure at least some browsers will not error correct that for you.

    Edit: I see that line is not used though in your finished script, in fact may be removed. However, in the code where I said that would not work, from your first post in this thread, there is nothing to show how the show starts but that syntax and it clearly will not work. So it was a bit dishonest on your part, but probably an honest mistake.
    Last edited by jscheuer1; 10-27-2009 at 06:16 PM. Reason: tried code
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

Bookmarks

Posting Permissions

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