2004/09/06 | 简单的图片验证码
类别(JScript) | 评论(0) | 阅读(133) | 发表于 10:48
<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>
0

评论Comments

日志分类
首页[102]
.Net[11]
VBScript[1]
JScript[51]
XML[3]
HTML&CSS[9]
ASP[8]
ActiveX[4]
Software[10]
Other[5]