排序數據的示例,多个数字用逗号分隔For ASP

来源:互联网 发布:centos jdk1.8 rpm 编辑:程序博客网 时间:2024/05/17 20:28
  1. <%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
  2. <head>
  3. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  4. <title>排序數據的示例</title>
  5. </head>
  6. <%
  7. '==========================================
  8. '  這是一個排序資料的示例,输入多个数字,用逗号分隔
  9. '  程式将其按从小到大排列
  10. '==========================================
  11. on error resume next
  12. a=trim(request("t1"))
  13. if a="" then
  14.   response.Write("Please input number in textbox,use "" , "" split")
  15. else
  16. b=split(a,",")
  17. for i=0 to UBound(b)
  18.    for j=i+1 to UBound(b)
  19.       if cint(b(i))>cint(b(j)) then
  20.             c=b(i)
  21.                b(i)=b(j)
  22.                b(j)=c
  23.          end if
  24.    next
  25. next
  26. for i=0 to Ubound(b)
  27.   Response.Write(b(i)+"<br />")
  28. next
  29. end if
  30. if err.num<>0 then
  31.   err.clear()
  32. end if
  33. %>
  34. <form name="form1" method="post" action="">
  35.   <input name="t1" type="text" id="t1" size="100">
  36.   <input type="submit" name="Submit" FONT-FAMILY: 'PMingLiU','serif'; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">提交">
  37. </form>
原创粉丝点击