在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
asp中不能用switch语句,要用select case语句了 简单的介绍一下 选择报表的工作一样,如果语句。然而不同的是,他们可以检查多个值。当然,你有 select case expression case label_1 statements_1 case label_2 statements_2 ... case else statements_n end select 该计划首先查找与匹配的表达式的值标签的情况,然后条控制转移到该条款,执行相 <%@ language="vbscript"> <% Dim Flower Flower = "rose" select case flower case "rose" response.write(flower & " costs $2.50") case "daisy" response.write(flower & " costs $1.25") case "orchild" response.write(flower & " costs $1.50") case else response.write("There is no such flower in our shop") end select %> 例子1、 <% '/*ASP中用select case代替其他语言中的switch case, default用case else*/ dim today today = 5 select case today case 0 str = "星期天" case 1 str = "星期一" case 2 str = "星期二" case 3 str = "星期三" case 4 str = "星期四" case 5 str = "星期五" case 6 str = "星期六" case 7, 8, 9 str = "today的值是7,8,或9" case else str = "未知" end select response.write str response.End() %> /*------------输出结果-------- 星期五 ------------*/ 实例2、 board=request("board") select case board case "1" boardName = "技术版" case "2" boardName = "信息版" case "3" boardName = "客服星空" case "4" boardName = "灌水区" case "5" boardName = "市场营销" case "6" boardName = "经理论坛" case "7" boardName = "影音论坛" case "8" boardName = "延伸服务" case "9" boardName = "东北片区" case "10" boardName = "市场动态" case "11" boardName = "群发交流" case "12" boardName = "hombre" case "14" boardName = "论坛" case "15" boardName = "在线答疑" case else boardName = "极客世界" end select 注意:case "1"后面不能有冒号,boardName = "技术版"后面不能有分号,而且不能出现break语句 |
请发表评论