This semester just learned with JavaScript random validation code generation pro

Recommended for you: Get network issues from WhatsUp Gold. Not end users.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>JavaScript scripting language (dynamic switching and verification code of practice)</title>

<style type="text/css">
*{ margin:0px auto;}
#top{ width:960px;}
#nav{ background-image:url(../image1/login_head.gif); background-repeat:no-repeat; width:360px; height:25px; margin-top:20px; padding-left:20px; color:#FFF; padding-top:3px;}
#main{ width:380px; height:340px; text-align:center; font-size:14px; border:1px #009; background:#09F;}
#qqtop1{ float:left; width:100px; height:18px; padding-top:5px;}
#qqtop2{ width:280px; height:20px; float:right; }


#right{ float:left;}
.font{ color:#F0F;font-size:30px;font-Microsoft family: black; }
</style>

<script type="text/javascript">
 function chang(num)
 {
     if(num==1)
     {
        document.getElementById("qid").style.display="none";
        document.getElementById("qqh").style.display="block";
        document.getElementById("qqm").style.display="block";     
     }else
     {
        document.getElementById("qid").style.display="block";
        document.getElementById("qqh").style.display="none";
        document.getElementById("qqm").style.display="none";     
     }
 } 
 var str="";
 function radom()//Code method
 {
    var j=new Array("0","1","2","3","8","9","a","b","c","d");
    
    for(var i=0;i<4;i++)
    {
        var num=parseInt(Math.random()*j.length);
        str+=j[num];    
    }    
    document.getElementById("yzm").innerHTML=str;
    document.getElementById("yzm").className="font";
 }
 
 function gb()
 {
     str="";
    radom();     
 }
 

function ok()
{
     var yzm=document.getElementById("yzm").innerHTML.toUpperCase();
      str=document.getElementById("yz").value;
    if(yzm==str.toUpperCase())
    {
        alert("Login is successful!");    
    }else
    {
        alert("my god!Verification code is wrong, please input from New!");
        gb();    
    }    
}
</script>    
</head>

<body>
<div id="top">
<img src="../image1/top.jpg" />
</div>
<div id="nav">
Pat user login
</div>
<div id="main">
<div id="qqtop1">Login mode choice:</div>
<div id="qqtop2">
  <input type="radio" name="checd" checked="checked" />QQ number entry
<input type="radio" name="checd" />QQ group number login
</div><br/>
<div id="qqh" style="margin-top:30px;">
QQ number: <input type="text" />Forget the QQ number〉〉
</div><br/>
<div id="qid" javascript: style="display:none; padding-right:90px;" >
QQ group Id: <input type="text"  />
</div>
<div id="qqm">
QQ password: <input type="password" />QQ password〉〉
</div><br/><br/>
<div  style=" padding-right:90px;" >
Verification code: <input type="text" value="Please enter the text to display" id="yz" />
</div><br/>
<div id="qqh" style=" padding-right:110px; color:#00F;">
<label>Look not clear, change a</label>
</div><br/>
<div style="height:40px; width:100px; background-color:#03F; padding-top:20px; margin-left:100px;" >
<label id="yzm"></label>
</div><br/>

<input type="button" value="& nbsp; & nbsp;." style="background-color:#03F; padding-top:5px; margin-right:80px; height:30px; width:100px" />

</div>
</body>
</html>

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download

Posted by Johnny at November 17, 2013 - 12:18 PM