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 9277921
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T17:13:52+00:00 2026-06-18T17:13:52+00:00

Simple request, but I don’t know how to do it. I’ve got a series

  • 0

Simple request, but I don’t know how to do it. I’ve got a series of 10 images (image0.gif, image1.gif image2.gif etc…) that need to change to the next image in the sequence (cycling around after 9) when another image is pressed. This is what I have so far…

 <html>  
    <head></head>
    <body bgcolor="#808080">
        <script type="text/javascript">
            var c = 0;
            function preload(img) {
                var a = new Image();
                a.src = img;
                return a;
            }

            if (needed) {
                time0 = preload("image0.gif");
                time1 = preload("image1.gif");
                time2 = preload("image2.gif");
                time3 = preload("image3.gif");
                time4 = preload("image4.gif");
                time5 = preload("image5.gif");
                time6 = preload("image6.gif");
                time7 = preload("image7.gif");
                time8 = preload("image8.gif");
                time9 = preload("image9.gif");
            }

            function clickme() {
                // update image
                c += 1;
                // alert(c)
            }
        </script>
        <div align="center">
            <center>
                <img src="images/image0.gif" width="20" height="55" name="time0"> <a href="#" onMouseDown="return clickme()">
                    <img src="images/button.gif" border="0" width="96" height="55">
                    </a>
                </td>
                </tr>
                </table>
            </center>
        </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-18T17:13:53+00:00Added an answer on June 18, 2026 at 5:13 pm

    First, you can and should take advantage of the fact, that only thing diferrent in the each umage name is number. So, you can store number and create any image name:

    function getImage(id) {
        return "image"+id+".gif";
    }
    

    Then, you should have a way to acces the image that you want to change. Like adding id to he element:

    <img id="changing" src="image0.png" />
    

    There should be onclick used, not onmousedown. User may change his mind and hower the mouse away – that is not click:

    <a href="#" onclick="clickme()" />
    

    Finally, changing the image element:

    var c=0;
    var max = 9;
    function clickme() {
       c++;
       if(c>max)
         c=0;   //looping back to zero
       docment.getElementById("changing").src = getImage(c);  //getImage is defined above
     }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

One possible solution could be simple HTTP get or post request, but that wouldn't
I think I've got what sounds like a simple request but is probably actually
The request is a simple one, but is hard to google for. Here are
I am developing a SSL client that will do a simple request to a
I've wrote very simple minification/compression handler that minify css and js by indicating request
My problem is very simple to explain but I don't success to find the
Honestly, I don't know a lot about PHP but I think what I need
I'm getting some error. I know what is the problem but I don't know
The question might be very simple, but I don't understand how the null values
I'm sorry for the bad title (edit if you wish), but I don't know

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.