How to make a Captcha "Enter the number from the picture"?

  • 0

    I searched the Internet, but there is only PHP. All I need is HTML / JS just for homework.
    JavaScript Anonymous, Mar 21, 2020

  • 2 Answers
  • 0
    Well, a captcha that can stop bots can only be on the server.

    For homework, it's probably okay to draw numbers in the canvas tag

  • 0

    1. create and put pictures in a folder

    2. create an array with picture names

    3. generate a random number from 0 to the length of the array

    4. take the name of the picture from the array by the number equal to a random number.

    5. typeset the form with the corresponding image and its number in the data attribute

    6. when pressed, compare the number entered into the input with the value in the data attribute

    7. display the alert correctly / incorrectly


Your Answer
To place the code, please use CodePen or similar tool. Thanks you!