The multi-branching selection structure is characterized by selecting the first condition to be the true route from multiple selection structures as the execution line. The A1 block is executed when the given selection condition is true, and the next condition is continued if false. If the condition is false, the other action block is executed, and if there is no other action block, the selection is ended without any action. Its grammatical structure is as follows:
Select Case <测试条件>
[Case <表达式1>
[ <语句列1> ]]
[Case <表达式2>
[ <语句列1> ]]
...
[Case Else
[ <其他语句列> ]]
End Select
Simple Example 1:
Use of <title>if...then statements </title>
<script language= "VBScript" >
<!--
Sub bchange (choice)
Select Case Choice
Case 1
Document.bgcolor= "#9AD3AF"
Case 2
Document.bgcolor= "#F3FAC5"
Case 3
Document.bgcolor= "#CDC8F7"
Case 4
Document.bgcolor= "#F8C7DA"
Case 5
Document.fgcolor= "#69011C"
Case 6
Document.fgcolor= "#264436"
Case 7
Document.fgcolor= "#D76817"
Case 8
Document.fgcolor= "#544976"
End Select
End Sub
-->
</Script>
<body>
<center>
<p><table border=2>
<tr><th> background Color <th> selection <th> text color <th> Select </tr>
<tr><td> Light green <td><input type=radio onclick= "bchange (1)" ><td> Crimson <td><input type =radio onclick= "bchange (5)" ></tr>
<tr><td> yellowish <td><input type=radio onclick= "bchange (2)" ><td> dark green <td><input type =radio onclick= "bchange (6)" ></tr>
<tr><td> Lavender <td><input Type=radio onclick= "bchange (3)" ><td> Orange yellow <td><input type =radio onclick= "bchange (7)" ></tr>
<tr><td> Light powder <td><input type=radio onclick= "bchange (4)" ><td> dark blue <td><input type =radio onclick= "bchange (8)" ></tr>
</table>
</center>
</body>
Simple Example 2:
<title>asp简单程序</title>
<body>
<%
dim aa,bb,cc,dd,ee,ff,my_time
my_time=time()
aa=#00:00:00#
bb=#07:00:00#
cc=#12:00:00#
dd=#14:00:00#
ee=#20:00:00#
ff=#23:59:59#
x=time()
select case true
case x>=aa and x<bb
response.write("早上好 ,欢迎你的光临 !")
case x>bb and x<cc
response.write(" 上午好,欢迎你的光临 !")
case x>cc and x<dd
response.write("中午好 ,欢迎你的光临 !")
case x>dd and x<ee
response.write("下午好 ,欢迎你的光临 !")
case x>ee and x<ff
response.write("晚上好 ,欢迎你的光临 !")
end select
%>
</body>
See the full set of ASP Getting started tutorials