<HTML>
<HEAD>
<script language="VBS">
SUB GetMax_onclick
Arr=split(mytext.value,"|")
Arrlen=UBound(Arr)
//以下一步很重要
for i=0 to Arrlen
Arr(i)=CLng(Arr(i))
next
//沉底排序
for i=0 to Arrlen
for j=i to Arrlen-1
if(Arr(j)>Arr(j+1)) then
temp=Arr(j+1)
Arr(j+1)=Arr(j)
Arr(j)=temp
end if
next
next
//沉底排序结束Arr中序号最大的数放在数组的最后面
MAX=Arr(Arrlen)
alert(MAX)
for i=Arrlen to 0 step -1
if(Arr(i)=MAX) then
alert(Arr(i))
else
exit for
end if
next
END SUB
SUB GetMin_onclick
.....
END SUB
</script>
</HEAD>
<BODY>
<input type="text" name="mytext">
<br>
<input type="button" name="GetMax" value="Max"><input type="button" name="GetMin" value="Min">
</BODY>
</HTML>
实现了你的输出最大数要求,输出最小数方法差不多。要注意,要求输入皆为数字
<%
dim i,a,b,c
a="54|56|87|98|32|12"
b=split(a,"|")
c=cdbl(b(0))
for i=1 to ubound(b)-1
if cdbl(b(i))>c then
c=cdbl(b(i))
end if
next
response.write "max is"&c
%>