Often to the major web site to leave a message or post a friend should know that many sites are now the message place of the verification code is not directly displayed. It is only after the click of the Verification Code input box will show the verification code. The following author also summed up an article on how to use JS to click the text box and then load the verification code effect.
First of all, let's say why do this, according to the author, the effect should be not only for the sake of aesthetics, but also more to prevent people with ulterior motives from using robots to send spam messages or spam posts. Because we set up a code to prevent the robot from leaving a message on the website, there are rumors that a robot can recognize the code picture. So what's the deal? Then add a step more like a human operation, that is, add this effect, click on the input box, more to determine that we are individuals, not robots.
Okay, cut the crap, here's the concrete implementation code.
The above is very simple, in fact, more popular and practical should be Ajax form, below to see the use of Ajax to achieve this effect of the method .
(1) The first is to generate the code of the PHP file (checkcode.php), there is no reference to the following two articles, here is not to put the code.
PHP Build Verification Code function
PHP Generate dynamic Verification code picture
(2) The specific HTML file and processing code are as follows: