ASP--VB流程控制,for循环

来源:互联网 发布:java爬虫 zol壁纸 编辑:程序博客网 时间:2024/06/12 18:12

<script language="vbs">
    'VBScript流程控制
    '                '显示信息      '显示标题    获得输入
    score= inputbox("请输入一个数字","成绩系统")
   
    '第一种流程控制
    'if then
    'if 1<2 then msgbox "1小于2"
    '有多个执行语句的情况
    if 1<2 then
        'msgbox "1小于2"
        'msgbox "哈哈"
    end if
       
   
    '第二种流程控制,双向选择
    if score>90 then
     'msgbox "优秀"
    else
     'msgbox "及格了"
    end if
   
    '第三种流程控制,多项选择
    if score > 90 then
        'msgbox "优秀"
    elseif score >80 then
        'msgbox "中等"
    else
        'msgbox "及格"
    end if
   
    '第四种流程控制,select --- case
    select case score
        case 34
            'msgbox 34
        case 80
            'msgbox 80
        case 90
            'msgbox 90
        case else
            'msgbox "else"
    end select
   
    //for循环 step 步长 每次i加上的步数
    total=0
    for i=1 to 100 step 1
        total=i+total
    next
    msgbox total
    //docuemnt.write 向页面写入数据
    document.write total
</script>

本文出自 “Kenan_ITBlog” 博客,请务必保留此出处http://soukenan.blog.51cto.com/5130995/1075660