Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. JavaScript
  4. Slide show

Slide show

Scheduled Pinned Locked Moved JavaScript
javajavascripthtmlcomtools
4 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    Tichaona J
    wrote on last edited by
    #1

    I’m trying to get my website to show images one after the other using java script I got from www.javascriptkit.com/howto/show2.shtml and have followed there example as closely as I can but with no luck.

    <head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
    <title>Acrele - Home</title>
    <meta name="keywords" content="" />
    <meta name="description" content="" />

    <script type="text/javascript">

        var image1=new Image()
        image1.src="16.jpg"
    
        var image2=new Image()
        image2.src="employee-training.jpg"
    
        var image3=new Image()
        image3.src="Real\_Estate\_Investment\_Education.jpg"
    
        var image4=new Image()
        image4.src="Unti2tled.jpg"
    
        var image5=new Image()
        image5.src="Untitled.jpg"
    
        var image6=new Image()
        image6.src="zclassroom.jpg"
    

    </script>

    </head>

    2. Added the html code were I want the image to show:

                                    ![](16.jpg)
    

    3. Edited there javascript accordingly to the number of images I’m using:

                                    ![](16.jpg)
    
                                    <script>
                                    var step=1;
    
                                  //if browser does not support the image object, exit.
                                  var img = document.getElementById('slide');
                                  img.src = "image" + step + ".src";
                                  console.log(img.src);
                                  if (step < 6) step++;
                                      else step = 1;
                                      //call function "slideit()" every 2.5 seconds
                                      setTimeout(slideit, 3500);
    
    
                             </script>
    

    This isn’t working, it onl

    G J A 3 Replies Last reply
    0
    • T Tichaona J

      I’m trying to get my website to show images one after the other using java script I got from www.javascriptkit.com/howto/show2.shtml and have followed there example as closely as I can but with no luck.

      <head>
      <meta http-equiv="content-type" content="text/html; charset=utf-8" />
      <title>Acrele - Home</title>
      <meta name="keywords" content="" />
      <meta name="description" content="" />

      <script type="text/javascript">

          var image1=new Image()
          image1.src="16.jpg"
      
          var image2=new Image()
          image2.src="employee-training.jpg"
      
          var image3=new Image()
          image3.src="Real\_Estate\_Investment\_Education.jpg"
      
          var image4=new Image()
          image4.src="Unti2tled.jpg"
      
          var image5=new Image()
          image5.src="Untitled.jpg"
      
          var image6=new Image()
          image6.src="zclassroom.jpg"
      

      </script>

      </head>

      2. Added the html code were I want the image to show:

                                      ![](16.jpg)
      

      3. Edited there javascript accordingly to the number of images I’m using:

                                      ![](16.jpg)
      
                                      <script>
                                      var step=1;
      
                                    //if browser does not support the image object, exit.
                                    var img = document.getElementById('slide');
                                    img.src = "image" + step + ".src";
                                    console.log(img.src);
                                    if (step < 6) step++;
                                        else step = 1;
                                        //call function "slideit()" every 2.5 seconds
                                        setTimeout(slideit, 3500);
      
      
                               </script>
      

      This isn’t working, it onl

      G Offline
      G Offline
      Graham Breach
      wrote on last edited by
      #2

      You have removed the code from inside the "slideit" function, so now there is no way for it to repeat and the setTimeout(slideit, 3500) is trying to call a function that doesn't exist.

      1 Reply Last reply
      0
      • T Tichaona J

        I’m trying to get my website to show images one after the other using java script I got from www.javascriptkit.com/howto/show2.shtml and have followed there example as closely as I can but with no luck.

        <head>
        <meta http-equiv="content-type" content="text/html; charset=utf-8" />
        <title>Acrele - Home</title>
        <meta name="keywords" content="" />
        <meta name="description" content="" />

        <script type="text/javascript">

            var image1=new Image()
            image1.src="16.jpg"
        
            var image2=new Image()
            image2.src="employee-training.jpg"
        
            var image3=new Image()
            image3.src="Real\_Estate\_Investment\_Education.jpg"
        
            var image4=new Image()
            image4.src="Unti2tled.jpg"
        
            var image5=new Image()
            image5.src="Untitled.jpg"
        
            var image6=new Image()
            image6.src="zclassroom.jpg"
        

        </script>

        </head>

        2. Added the html code were I want the image to show:

                                        ![](16.jpg)
        

        3. Edited there javascript accordingly to the number of images I’m using:

                                        ![](16.jpg)
        
                                        <script>
                                        var step=1;
        
                                      //if browser does not support the image object, exit.
                                      var img = document.getElementById('slide');
                                      img.src = "image" + step + ".src";
                                      console.log(img.src);
                                      if (step < 6) step++;
                                          else step = 1;
                                          //call function "slideit()" every 2.5 seconds
                                          setTimeout(slideit, 3500);
        
        
                                 </script>
        

        This isn’t working, it onl

        J Offline
        J Offline
        jkirkerx
        wrote on last edited by
        #3

        There are a lot of bad slideshow scripts out there, I rewrote one that was a CMS plugin for word press which had many errors in it, and made no sense to me. It might be too advanced for you, and requires JQuery, but is simplistic in design. [Display Advertising Filmstrip^]

        1 Reply Last reply
        0
        • T Tichaona J

          I’m trying to get my website to show images one after the other using java script I got from www.javascriptkit.com/howto/show2.shtml and have followed there example as closely as I can but with no luck.

          <head>
          <meta http-equiv="content-type" content="text/html; charset=utf-8" />
          <title>Acrele - Home</title>
          <meta name="keywords" content="" />
          <meta name="description" content="" />

          <script type="text/javascript">

              var image1=new Image()
              image1.src="16.jpg"
          
              var image2=new Image()
              image2.src="employee-training.jpg"
          
              var image3=new Image()
              image3.src="Real\_Estate\_Investment\_Education.jpg"
          
              var image4=new Image()
              image4.src="Unti2tled.jpg"
          
              var image5=new Image()
              image5.src="Untitled.jpg"
          
              var image6=new Image()
              image6.src="zclassroom.jpg"
          

          </script>

          </head>

          2. Added the html code were I want the image to show:

                                          ![](16.jpg)
          

          3. Edited there javascript accordingly to the number of images I’m using:

                                          ![](16.jpg)
          
                                          <script>
                                          var step=1;
          
                                        //if browser does not support the image object, exit.
                                        var img = document.getElementById('slide');
                                        img.src = "image" + step + ".src";
                                        console.log(img.src);
                                        if (step < 6) step++;
                                            else step = 1;
                                            //call function "slideit()" every 2.5 seconds
                                            setTimeout(slideit, 3500);
          
          
                                   </script>
          

          This isn’t working, it onl

          A Offline
          A Offline
          alisener1980
          wrote on last edited by
          #4

          you must use setinterval...

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups