- VBScript教程
- VBScript - 主页
- VBScript - 概述
- VBScript - 语法
- VBScript - 启用
- VBScript - 布局
- VBScript - 变量
- VBScript - 常量
- VBScript - 运算符
- VBScript - 决策
- VBScript - 循环
- VBScript - 事件
- VBScript - Cookie
- VBScript - 数字
- VBScript - 字符串
- VBScript - 数组
- VBScript - 日期
- VBScript高级版
- VBScript - 过程
- VBScript - 对话框
- VBScript -面向对象
- VBScript - 正则表达式
- VBScript - 错误处理
- VBScript - 其他语句
- VBScript有用资源
- VBScript - 问答
- VBScript - 快速指南
- VBScript - 有用资源
- VBScript - 讨论
VBScript如果-否则语句
一个如果语句包含一个布尔表达式,后跟一个或多个语句。如果条件为真,则执行如果条件下的语句。如果条件为假,则执行否则部分下的语句。
语法
VBScript 中if…else 语句的语法为 -
If(boolean_expression) Then Statement 1 ..... ..... Statement n Else Statement 1 ..... .... Statement n End If
流程图
示例
<!DOCTYPE html>
<html>
<body>
<script language = "vbscript" type = "text/vbscript">
Dim a : a = 5
Dim b : b = 25
If a > b Then
Document.write "a is Greater"
Else
Document.write "b is Greater"
End If
</script>
</body>
</html>
执行上述代码时,将产生以下结果 -
b is Greater
vbscript_decisions.htm
广告