This article mainly describes how to use jQuery and Angular to implement the logon Interface Verification Code. For more information about how to use jQuery and Angular to implement the logon Interface Verification code, see the next article, for more information, see
Preface:
In the previous event, I used the ajax background Asynchronous interaction login function and added a verification code on it. The principle behind this function is quite understandable and easy to implement, I would like to write a blog to share this article. I have made a lot of mistakes in my own writing process. Here I will write more details as shown in the following example. You can make a reference. A favorite friend can give me a thumbs up, or follow a wave.
The final effect:
Jnshu background Logon
Here is the jq code implementation part:
Var authCode; randomCode = $ ("# js5-authCode "). eq (0); // obtain the domconsole box in the verification code. log (randomCode); function createCode () {authCode = ""; // set this to an empty variable, and then add the random number var authCodeLength = 4 to it; // random number length randomArray = [, 'A', 'B', 'C', 'D', 'E ', 'F', 'G', 'h', 'I', 'J', 'k', 'l', 'M', 'n', 'O ', 'P', 'Q', 'R','s ', 't', 'U', 'V', 'w', 'x', 'y ', 'Z']; // create an array. select four digits or more for (var I = 0; IThis is the angular code implementation part:
The details of the jq part are also quite detailed here. If you don't understand it, you can look back at the jq part. The principles are the same. Copy it to your local computer and try again.
Var enter = angular. module ("myApp"); enter. controller ('enterctrl ', [' $ scope ',' $ http', '$ State', function ($ scope, $ http, $ state) {$ scope. changeVerify = function () {// defines a click event and obtains the verification code var authCode = ""; var authCodeLength = 4; // retrieves several random numbers var randomArray = [0, 1, 2, 3, 4, 5, 6, 8, 9, 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'h ', 'I', 'J', 'k', 'l', 'M', 'n', 'O', 'P', 'Q', 'R ', 'S ', 't', 'U', 'V', 'w', 'x', 'y', 'z']; for (var I = 0; IRemarks
It has been written on and off for two days and is not as fast as before .. If you have any questions, leave a message in the comment area. If you have any questions, please kindly advise.
The above describes how to use jQuery + Angular to implement the login interface verification code function. For more information, see other related articles in the first PHP community!