<title></title>
<style type= "Text/css" >
. Code
{
Background:url (code_bg.jpg);
font-family:arial;
Font-style:italic;
Color:blue;
font-size:30px;
border:0;
PADDING:2PX 3px;
letter-spacing:3px;
Font-weight:bolder;
Float:left;
Cursor:pointer;
width:150px;
height:60px;
line-height:60px;
Text-align:center;
Vertical-align:middle;
}
A
{
Text-decoration:none;
font-size:12px;
Color: #288bc4;
}
A:hover
{
Text-decoration:underline;
}
</style>
<script language= "javascript" type= "Text/javascript" >
var code;
function Createcode () {
Code = "";
var codelength = 6; The length of the Verification code
var checkcode = document.getElementById ("Checkcode");
var codechars = new Array (0, 1, 2, 3, 4, 5, 6, 7, 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 ',
' 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 '); All the candidate components of the verification code, of course, can also be used in Chinese
for (var i = 0; i < codelength; i++)
{
var charNum = Math.floor (Math.random () * 52);
Code + + Codechars[charnum];
}
if (Checkcode)
{
Checkcode.classname = "code";
checkcode.innerhtml = code;
}
}
function Validatecode ()
{
var inputcode = document.getElementById ("Inputcode"). Value;
if (inputcode.length <= 0)
{
Alert ("Please enter the verification code!") ");
}
else if (inputcode.touppercase ()!= code.touppercase ())
{
Alert ("The authentication code input is wrong!") ");
Createcode ();
}
Else
{
Alert ("Verify code is correct!) ");
}
}
</script>
<body onload= "Createcode ()" >
<form id= "Form1" runat= "Server" onsubmit= "Validatecode ()" >
<div>
<table border= "0" cellspacing= "5" cellpadding= "5" >
<tr>
<td></td><td> <div class= "code" id= "Checkcode" onclick= "Createcode ()" ></div></td >
<td><a href= "#" onclick= "Createcode ()" > can't see a replacement </a></td>
</tr>
<tr>
<td> Verification Code: </td><td><input style= "Float:left" type= "text" id= "Inputcode"/></td><td > Please enter the verification code </td>
</tr>
<tr><td></td><td><input id= "Button1" onclick= "Validatecode ();" type= "button" value= "OK" /></td><td></td>
</tr>
</table>
</div>
</form>
</body>