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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T02:07:15+00:00 2026-05-13T02:07:15+00:00

I want to create a captcha in my website. I will try to describe

  • 0

I want to create a captcha in my website. I will try to describe how I want to do that. See the code below please:

<img src=”captcha_img.png”>   <img src=”reload.png”>  <a href=”..”>Reload Captcha Image</>

What I want to do is, to click on “Reload Captcha Image” link and with JavaScript change the content of the first img tag to a new captcha image, and simultaneously to change reload.png to reload.gif which is and animation that I want to last as much as the new captcha image is being processed. And I want to change back the reload.gif animation to the reload.png static image, right the same time when the new captcha image has been load image. The problem is that the captcha image is being generated by GD library of PHP, and I don’t know how much time that will take to create a new image.
Please help me to be able to synchronize. May be there is a good approach for doing this kind of things…

Thanks!

  • 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-05-13T02:07:15+00:00Added an answer on May 13, 2026 at 2:07 am

    You can use the onload event on the image, to know exactly when your new captcha image has been loaded on the browser, I added IDs to your markup:

    <img id="captcha" src="captcha_img.png">
    <a id="reloadLink" href="..">
      <img id="reloadImg" src="reload.png"> Reload Captcha Image
    </a>
    

    Then in your code, you connect the event handlers:

    // Connect event handlers
    window.onload = function () {
      // get the DOM elements
      var captcha = document.getElementById('captcha'),
          reloadImg = document.getElementById('reloadImg'),
          reloadLink = document.getElementById('reloadLink');
    
      // reload the captcha image when the link is clicked
      reloadLink.onclick = function () {
        var captchaURL = "captcha.php"; // change this with your script url
    
        captcha.src = captchaURL + "?nocache=" + (+new Date()); // cache breaker
        reloadImg.src = "reload.gif"; // set "animated" reload image
        return false; // prevent link navigation
      };
    
      captcha.onload = function () { // when the captcha loaded, restore reload image
        reloadImg.src = "reload.png"; // "static" reload image
      };
    };
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want create wordpress website into which I want create user management... That means
I want create a tarball that when extracted the file(s) will be placed at
I want create constructor that will take one or more integers and save it
i want create a custom json data from the mssql 2008 results so that
i want create Dynamic Slideshow in Jquery i'm Write this code var ctx =
I want to create a new field (or two) in my table that is
In C# code, I want create a log file for each each method in
I want create texture atlas(matrix of images) from multiple images.Is their any applescript that
I want create a cache so that when an item doesn't exist, only one
I want create a function that verify if the numbers of a list fall

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.