排序數據的示例,多个数字用逗号分隔For ASP
来源:互联网 发布:centos jdk1.8 rpm 编辑:程序博客网 时间:2024/05/17 20:28
- <%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
- <title>排序數據的示例</title>
- </head>
- <%
- '==========================================
- ' 這是一個排序資料的示例,输入多个数字,用逗号分隔
- ' 程式将其按从小到大排列
- '==========================================
- on error resume next
- a=trim(request("t1"))
- if a="" then
- response.Write("Please input number in textbox,use "" , "" split")
- else
- b=split(a,",")
- for i=0 to UBound(b)
- for j=i+1 to UBound(b)
- if cint(b(i))>cint(b(j)) then
- c=b(i)
- b(i)=b(j)
- b(j)=c
- end if
- next
- next
- for i=0 to Ubound(b)
- Response.Write(b(i)+"<br />")
- next
- end if
- if err.num<>0 then
- err.clear()
- end if
- %>
- <form name="form1" method="post" action="">
- <input name="t1" type="text" id="t1" size="100">
- <input type="submit" name="Submit" FONT-FAMILY: 'PMingLiU','serif'; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">提交">
- </form>