Detailed Description: Use jQuery + Angular to implement the login interface Verification Code Function

Source: Internet
Author: User
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; I

This 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; I

Remarks

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!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.