dim sz_num
sz_num=request.form("input_num")
'sz_num=-20
if sz_num>=1 and sz_num<=100 then
'response.write "t"
response.write "<script>alert('输入正确')history.back()</script>"
else
'response.write "f"
response.write "<script>alert('输入错误')history.back()</script>"
end if
else
%>
<form name="num" action="test.asp?action=action_num" method="post">
<input type="text" name="input_num" value="" size="30">
<input type="submit" name="action_num" value="判断">
</form>
<%end if%>
'将下列代码保存到一个文本文档中然后将后缀名改为vbs即可执行:Dim i, int1(3), str1(3), s
int1(0) = 22
int1(1) = 14
int1(2) = 6
int1(3) = 13
Call sortFigu(int1)'调用过程进行处理
For i = LBound(int1) To UBound(int1)
s = s & CStr(int1(i)) & " "
Next
MsgBox s'显示int1排序后的结果
str1(0) = "d"
str1(1) = "a"
str1(2) = "j"
str1(3) = "b"
Call sorString(str1)'调用过程进行处理
s = ""
For i = LBound(str1) To UBound(str1)
s = s & CStr(str1(i)) & " "
Next
MsgBox s'显示str1排序后的结果
Private Sub sortFigu(ByRef int1)'数字数组升序排序
Dim i, j, temp
For i = LBound(int1) To UBound(int1)
For j = i To UBound(int1)
If int1(i) > int1(j) Then
temp = int1(i)
int1(i) = int1(j)
int1(j) = temp
End If
Next
Next
End Sub
Private Sub sorString(ByRef str1)'字符数组降序排序
Dim i, j,temp
For i = LBound(str1) To UBound(str1)
For j = i To UBound(str1)
If str1(i) < str1(j) Then
temp = str1(i)
str1(i) = str1(j)
str1(j) = temp
End If
Next
Next
End Sub
'以上只是个演示,里面的两个过程你可以放到你的网页中调用
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)