当前位置: 代码迷 >> ASP >> 随机函数的小疑点
  详细解决方案

随机函数的小疑点

热度:154   发布时间:2012-03-20 14:01:11.0
随机函数的小问题
<%
RANDOMIZE
r=INT(RND()*(9-1+1))+1
dim   a1
a1= "张锁 "
a2= "车想 "
a3= "小锣 "
a4= "许并 "
a5= "例好 "
a6= "我晕 "
a7= "的你 "
a8= "学习 "
a9= "没有 "

dim   k
k=a+r
%>

<form   name= "Attend "   method= "post "   action= "04.asp ">
    <p> &nbsp; </p>
    <table   width= "760 "   border= "2 "   align= "center ">
        <tr>
            <td   width= "8% "   bgcolor= "#D4D0C8 "> <div   align= "center "> 姓名 </div> </td>
            <td   width= "42% "> <label>
                <input   name= "textfield1 "   type= "text "   class= "jk "   id= "textfield1 "   value= " <%=k%> ">


表单显示出来的还是产生的随机数字   并没有把变量赋进去   怎么弄??

------解决方案--------------------
k=eval( "a " & r)
------解决方案--------------------
<%
RANDOMIZE
r=INT(RND()*(9-1+1))+1
dim a
a(1)= "张锁 "
a(2)= "车想 "
a(3)= "小锣 "
a(4)= "许并 "
a(5)= "例好 "
a(6)= "我晕 "
a(7)= "的你 "
a(8)= "学习 "
a(9)= "没有 "

dim k
if r> =1 and r <=9 then
k=a(r)
else
k= "无名氏 "
end if
%>
  相关解决方案