asp Select Case语句语法与实例教程
asp教程 select case语句语法与实例教程
select case 是一个条件选择他的好处是唯出口,很多时间他大优于if else哦。
<script language="vbscript" runat="server">
sub select1()
dim varweek '声明变量
varweek=weekday(now()) '获取代表今天是星期几的整数
response.write("<center>") '中间显示
response.write("<font size=10>") '显示的字体大小
select case varweek 'select case 条件选择语句
case 1 'varweek的值为1
response.write("今天星期日")
case 2 'varweek的值为1
response.write("今天星期一")
case 3 'varweek的值为2
response.write("今天星期二")
case 4 'varweek的值为3
response.write("今天星期三")
case 5 'varweek的值为4
response.write("今天星期四")
case 6 'varweek的值为5
response.write("今天星期五")
case 7 'varweek的值为6
response.write("今天星期六")
end select 'select case 语句结束标志
response.write("</font>")
end sub
</script>
<html>
<head>
<title>example18</title>
</head>
<body>
<%
select1
%>
</body>
</html>
select语句的语法如下:
select case expression
case label_1
statements_1
case label_2
statements_2
...
case else
statements_n
end select
更多详细内容请查看:http://www.zzzyk.com/asp/2/0ad10f01d7e31bbfce58e3700b98c897.htm
<%
sub getstar(hybuycount)
select case hybuycount
case 1
response.write"<img src=img/1.gif>"
case 3
response.write"<img src=img/2.gif>"
case 5
response.write"<img src=img/3.gif>"
case 10
response.write"<img src=img/4.gif>"
case 20
response.write"<img src=img/5.gif>"
case else
response.write"<img src=img/6.gif>"
end select
end sub
%>
补充:asp教程,技巧与性能优化