A method instance for refreshing or partially refreshing a. NET authentication code _ Practical Tips

Source: Internet
Author: User

Taking the refresh of the verification code as an example

Copy Code code as follows:

<form method= "POST" name= "Login" action= "" >
Verification code: <input type= "text" name= "code" class= "text code"/>

</form>


method One: Using the pseudo-class implementation of Javascrip

Copy Code code as follows:



method Two: the introduction of external files

Introducing an external file between the

Copy Code code as follows:

<script type= "Text/javascript" src= "Js/code.js" ></script>

External file code.js set Local refresh function

function code () {
var code = document.getelementbyidx_x_x (' code ');
Code.onclick = function () {
This.src= ' code.php?tm= ' +math.random ();
};
};


In addition, if you want to add a content next to the verification code, and then click the Content Verification code refresh, you can use the following methods

Copy Code code as follows:

<form method= "POST" name= "Login" action= "" >
Verification code: <input type= "text" name= "code" class= "text code"/>

<span id= "Update" > click Refresh Verification Code </span>

</form>


method One: Using the pseudo-class implementation of Javascrip

Copy Code code as follows:

<span id= "Update" onclick= "javascript:code.src= ' code.php?tm= ' +Math.random" ( ) "></span>

Method Two: The introduction of external files

Introducing an external file between the

Copy Code code as follows:

<script type= "Text/javascript" src= "Js/code.js" ></script>

External file code.js set Local refresh function

function code () {
var code = document.getelementbyidx_x_x (' code ');

var update = document.getelementbyidx_x_x (' Update ');
Update.onclick = function () {
Code.src= ' code.php?tm= ' +math.random ();
};
};

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.