|
|
简单的图片验证码 |
|
|
<script language="JScript" runat="Server"> function GetNO(num){ var NumArray=[ ["0","0","0","3c","66","66","66","66","66","66","66","66","3c","0","0","0"], ["0","0","0","30","38","30","30","30","30","30","30","30","30","0","0","0"], ["0","0","0","3c","66","60","60","30","18","c","6","6","7e","0","0","0"], ["0","0","0","3c","66","60","60","38","60","60","60","66","3c","0","0","0"], ["0","0","0","30","30","38","38","34","34","32","7e","30","78","0","0","0"], ["0","0","0","7e","6","6","6","3e","60","60","60","66","3c","0","0","0"], ["0","0","0","38","c","6","6","3e","66","66","66","66","3c","0","0","0"], ["0","0","0","7e","66","60","60","30","30","18","18","c","c","0","0","0"], ["0","0","0","3c","66","66","66","3c","66","66","66","66","3c","0","0","0"], ["0","0","0","3c","66","66","66","66","7c","60","60","30","1c","0","0","0"] ]; var str=[]; num=String(num).split(""); for(var i=0;i<NumArray[0].length;i++) for(var j=0;j<num.length;j++) str[str.length]=("0x"+NumArray[num[j]][i]); var str1="#define counter_width "+j*8; var str2="#define counter_height 16"; return str1+String.fromCharCode(13,10)+str2+String.fromCharCode(13,10)+"static unsigned char counter_bits[]={"+str+"}"; } function GetRnd(Num){ return Math.floor(Math.random()*Math.pow(10,Num)); } function NumCodeJS() { Response.buffer=true var zNum; var zNum=GetRnd(4); if (zNum<1000) zNum+=999; Session("GetCode") = zNum; Response.ContentType="image/x-xbitmap"; Session("GetCode") = zNum; Response.Write(GetNO(zNum)); } </script>
缺缺 发表于 2004-9-6 [所属栏目: JScript | 返回首页]
|
|
|