Advanced Search

Results 1 to 2 of 2

Thread: why slide show is not shown by browser

  1. #1
    Join Date
    May 2013
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unhappy why slide show is not shown by browser

    hi!
    i am doing a project and want to make slide show of images and using this code for this but in browser it is not displaying that slide show plz help me and inform me if their is any mistake i am doing. need your early response. thanks in advance.
    Code:
    <html>
    <head>
    <script>
    <!--
    	var image1=new Image()
    	image1.src="Healthy-Mix.jpg"
    	var image2=new Image()
    	image2.src="Bonvivant_bread.jpg"
    	var image3=new Image()
    	image3.src="Bonvivant.jpg"
    	var image4=new Image()
    	image4.src="candy-ice-cream.png"
    	var image5=new Image()
    	image5.src="Ice-Cream.png"
    	var image6=new Image()
    	image6.src="Mauj-Mango.png"
    	var image7=new Image()
    	image7.src="pizza.png"
    	var image8=new Image()
    	image8.src="products.jpg" 
    //-->
    </script>
    </head>
    <body>
    <img src="Healthy-Mix.jpg" name="slide" width="601" height="355" alt="Healthy Mix" />
                	<script>
    					<!--
    					var step=1;
    					function slideit(){
    					if (!document.images){
    					return
    					document.images.slide.src=eval("image"+step+".src")
    					}
    					if (step<8){
    						step++;
    						}
    					else{
    						step=1;
    						}
    					setTimeout("slideit()",2500);
    					}
    					slideit();
    					//-->
    				</script>
    </body>
    </html>
    Last edited by Beverleyh; Today at 01:43 PM. Reason: Formatting

  2. #2
    Join Date
    Dec 2008
    Location
    Portsmouth, UK
    Posts
    1,531
    Thanks
    2
    Thanked 350 Times in 346 Posts

    Default

    Code:
    <html>
    <head>
    <script>
    <!--
    	var image1=new Image()
    	image1.src="http://www.vicsjavascripts.org.uk/StdImages/Egypt5.jpg"
    	var image2=new Image()
    	image2.src="http://www.vicsjavascripts.org.uk/StdImages/Egypt6.jpg"
    	var image3=new Image()
    	image3.src="http://www.vicsjavascripts.org.uk/StdImages/Egypt7.jpg"
    	var image4=new Image()
    	image4.src="http://www.vicsjavascripts.org.uk/StdImages/Egypt8.jpg"
    	var image5=new Image()
    	image5.src="http://www.vicsjavascripts.org.uk/StdImages/Egypt9.jpg"
    	var image6=new Image()
    	image6.src="http://www.vicsjavascripts.org.uk/StdImages/Egypt10.jpg"
    	var image7=new Image()
    	image7.src="http://www.vicsjavascripts.org.uk/StdImages/Egypt11.jpg"
    	var image8=new Image()
    	image8.src="http://www.vicsjavascripts.org.uk/StdImages/Egypt12.jpg"
    //-->
    </script>
    </head>
    <body>
    <img src="Healthy-Mix.jpg" name="slide" width="601" height="355" alt="Healthy Mix" />
                	<script>
    					<!--
    					var step=1;
    					function slideit(){
    					if (!document.images){
    					return
    					}
    					document.images.slide.src=eval("image"+step+".src")
    					if (step<8){
    						step++;
    						}
    					else{
    						step=1;
    						}
    					setTimeout("slideit()",2500);
    					}
    					slideit();
    					//-->
    				</script>
    </body>
    </html>

    better

    Code:
    <html>
    <head>
    </head>
    <body>
    <img src="http://www.vicsjavascripts.org.uk/StdImages/Egypt5.jpg" id="slide" width="601" height="355" alt="Healthy Mix" />
    <script>
    <!--
    
    var Images=[
     'http://www.vicsjavascripts.org.uk/StdImages/Egypt5.jpg',
     'http://www.vicsjavascripts.org.uk/StdImages/Egypt6.jpg',
     'http://www.vicsjavascripts.org.uk/StdImages/Egypt7.jpg',
     'http://www.vicsjavascripts.org.uk/StdImages/Egypt8.jpg',
     'http://www.vicsjavascripts.org.uk/StdImages/Egypt9.jpg',
     'http://www.vicsjavascripts.org.uk/StdImages/Egypt10.jpg',
     'http://www.vicsjavascripts.org.uk/StdImages/Egypt11.jpg',
     'http://www.vicsjavascripts.org.uk/StdImages/Egypt12.jpg'
    ];
    
    
    function slideit(id,ary,ms){
     var o=slideit[id],rdy,z0=0;
     if (!o){
      o=slideit[id]={
       obj:document.getElementById(id),
       ary:[],
       ms:typeof(ms)=='number'&&ms>0?ms:1000,
       cnt:0
      }
      for (;z0<ary.length;z0++){
       o.ary[z0]=new Image();
       o.ary[z0].src=ary[z0];
      }
     }
     if (o&&o.obj){
      clearTimeout(o.to);
      rdy=o.ary[o.cnt]&&o.ary[o.cnt].width>40;
      if (rdy){
       o.obj.src=o.ary[o.cnt].src;
      }
      o.cnt=++o.cnt%o.ary.length;
      o.to=setTimeout(function(){ slideit(id); },rdy?o.ms:200);
     }
    }
    
    slideit('slide',Images,2500);
    
    //-->
    </script>
    </body>
    </html>
    Last edited by vwphillips; Today at 05:13 PM.
    Vic
    God Loves You and will never love you less.
    http://www.vicsjavascripts.org.uk/
    If my post has been useful please donate to http://www.operationsmile.org.uk/

Similar Threads

  1. Swiss Army Slide Show won't advance manually in Chrome Browser
    By gtraeber in forum Dynamic Drive scripts help
    Replies: 4
    Last Post: 02-27-2013, 09:12 PM
  2. Automatically resizing a fade-in slide show to fit the browser window
    By dadantes in forum Dynamic Drive scripts help
    Replies: 1
    Last Post: 10-02-2011, 04:32 AM
  3. Problem running slide show on IE9 browser
    By chrishull in forum Dynamic Drive scripts help
    Replies: 19
    Last Post: 09-05-2011, 12:35 PM
  4. Image Slide Show - Book Flip Slide Show
    By Peppy in forum Dynamic Drive scripts help
    Replies: 13
    Last Post: 01-17-2007, 03:11 PM
  5. DHTML Slide Show Script - Browser Support?
    By Paul180 in forum Dynamic Drive scripts help
    Replies: 1
    Last Post: 11-29-2005, 11:24 AM

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
  •