Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8729395
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T08:49:31+00:00 2026-06-13T08:49:31+00:00

I am really a beginner at javascript and wanted to create a small image

  • 0

I am really a beginner at javascript and wanted to create a small image slider. I have used setInterval to delay the loading so that it would create a slider effect. But somehow the images are not sliding and I have a hinch that the problem lies in the loop. I have already looked up at some options and am asking here as a last option. Thanks in advance.

<!Doctype html>
  <meta charset="UTF-8">
    <head>

<title>Simple Image Slider</title>
    <script type="text/javascript">
   var counter=0;
    var images=new Array['download.jpg','images (1).jpg','images.jpg'];

       function start(){

    setInterval("slide()",2000);
      }

    function slide(){
    for(counter=0;counter<images.length;counter++)
document.getElementById('mageslide').src=images[counter];
   }
 </script>
<link rel="stylesheet" type="text/css" href="style.css">
     </head>
     <body>
<div id="wrapper">
      <div class="slider" onload="start()">
          <img src="images.jpg" id="mageslide"></img>
       </div>
      **strong text** </div>
      </body>
    </html>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T08:49:32+00:00Added an answer on June 13, 2026 at 8:49 am

    Your slide() function is wrong, you’re supposed to iterate one image per interval, not all images in one interval iteration, try this fixed version:

    function slide(){
       window.counter++;
       if (window.counter >= window.images.length) {
          window.counter = 0;
       }
       document.getElementById('mageslide').src=window.images[window.counter];
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a beginner level Json question with MVC.net (I've never really used jquery
I apologize if this is a really beginner question, but I have not worked
we have to create different avd for different projects in eclipse. yes/no.I am really
I'm really a beginner, I'm reading many different Android books as I would like
I am a beginner to Javascript. And when I was practicing I have noticed
I'm really a beginner to Node.js and I have some questions. Firstly, if I
I have an image file name that consists of four parts: $Directory (the directory
I'm a beginner and I really need your help! I have an XML file
I'm really a beginner in Javascript, and trying what i read as much as
I'm really a beginner in Javascript and trying to add a p element inside

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.