我已经 弄出来了 现给大家 发布出来吧呵呵也许谁用的着呢
1.asp 文件内容
<!--#include file="2.asp"--><%
i=1 '年级号01
j=1 '课程号01
k=1 '卡的顺序00001
a=30 '月卡记号30
ss="" '卡号01010000130
for i=1 to 9 '年级循环
ss="0"&i
aa=ss '返回i循环前将前2位缓存
'//初二i=8和初三i=9是5门课
if i>7 then
v=5
else
v=3
end if
for j=1 to v '课程号循环
ss=ss&"0"&j
dd=ss '返回j循环前将前4位缓存
for k=1 to 10000 '卡顺序循环10000张
'判断位数
if len(k)=1 then
kk="0000"&k
elseif len(k)=2 then
kk="000"&k
elseif len(k)=3 then
kk="00"&k
elseif len(k)=4 then
kk="0"&k
else
kk=k
end if
ss=ss&kk
'添加标记
ss=ss&"30"
response.write(ss&"<br>")
response.write "<pre>" & gen_key(13) & "</pre>" & vbcrlf
ss=dd '返回j循环后添加前4位数字
response.write(i&"年级"&j&"课程的第"&k&"张卡<br>")
next
ss=aa '返回i循环后添加前2位数字
next
next
%>
2.asp的内容
<%
Function gen_key(digits)
'Create and define array
dim char_array(50)
char_array(0) = "0"
char_array(1) = "1"
char_array(2) = "2"
char_array(3) = "3"
char_array(4) = "4"
char_array(5) = "5"
char_array(6) = "6"
char_array(7) = "7"
char_array(8) = "8"
char_array(9) = "9"
char_array(10) = "A"
char_array(11) = "B"
char_array(12) = "C"
char_array(13) = "D"
char_array(14) = "E"
char_array(15) = "F"
char_array(16) = "G"
char_array(17) = "H"
char_array(18) = "I"
char_array(19) = "J"
char_array(20) = "K"
char_array(21) = "L"
char_array(22) = "M"
char_array(23) = "N"
char_array(24) = "O"
char_array(25) = "P"
char_array(26) = "Q"
char_array(27) = "R"
char_array(28) = "S"
char_array(29) = "T"
char_array(30) = "U"
char_array(31) = "V"
char_array(32) = "W"
char_array(33) = "X"
char_array(34) = "Y"
char_array(35) = "Z"
'Initiate randomize method for default seeding
randomize
'Loop through and create the output based on the the variable passed to
'the function for the length of the key.
do while len(output) < digits
num = char_array(Int((35 - 0 + 1) * Rnd + 0))
output = output + num
loop
'Set return
gen_key = output
End Function
'for h=1 to 1000
'Write the results to the browser, currently setting a 13 digit key
'response.write "<pre>" & gen_key(13) & "</pre>" & vbcrlf
'next
%>
[此贴子已经被作者于2007-9-24 11:28:21编辑过]