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 ();
};
};