| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 479 人关注过本帖
标题:我想写一段输入n就输出n组随机码但老写不对高手看看
只看楼主 加入收藏
dhdhzzw
Rank: 1
等 级:新手上路
帖 子:949
专家分:0
注 册:2007-8-13
结帖率:81.82%
收藏
 问题点数:0 回复次数:1 
我想写一段输入n就输出n组随机码但老写不对高手看看
下面的代码可以随机产生,但无法用输入n产生n组看看我哪错了?也就是例如我想输入20就产生20组随机数这样的效果


            <td width="191" height="25">*授权码生成:</td>
            <td width="351">
              <input name="digits" type="text" id="digits" size="30" maxlength="200"> <input type="submit6" name="Submit6" value="确认生成"> </td>
            <td width="349"><span style="font-weight: bold; color: #FF0000;">*请输入想生成的授权码组数</span></td>
          </tr>
          <tr>
            <td height="25" bgcolor="#ECF5FF"><font color="#FF0000">*</font>授权码生成:</td>
            <td colspan="2" bgcolor="#ECF5FF"><textarea name="textarea" cols="80" rows="25"><%
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.
[bold]digits=requset("digits")
for i =1 to digits
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[/bold]

'Write the results to the browser, currently setting a 13 digit key
response.write "" & gen_key(14) & "" & vbcrlf
response.write "" & gen_key(14) & "" & vbcrlf
response.write "" & gen_key(14) & "" & vbcrlf
response.write "" & gen_key(14) & "" & vbcrlf[/bold][/bold][/bold]%></textarea>
搜索更多相关主题的帖子: 随机 输出 输入 
2007-12-21 10:19
dhdhzzw
Rank: 1
等 级:新手上路
帖 子:949
专家分:0
注 册:2007-8-13
收藏
得分:0 
没人回答不过自己弄出来了
2007-12-21 12:25
快速回复:我想写一段输入n就输出n组随机码但老写不对高手看看
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.033687 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved