- 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 If 语句
If 语句由一个布尔表达式后跟一条或多条语句组成。如果条件为真,则执行If 条件下方的语句。如果条件为假,则执行If 循环后的语句。
语法
VBScript 中If 语句的语法如下 −
If(boolean_expression) Then Statement 1 ..... ..... Statement n End If
流程图
示例
<!DOCTYPE html>
<html>
<body>
<script language = "vbscript" type = "text/vbscript">
Dim a : a = 20
Dim b : b = 10
If a > b Then
Document.write "a is Greater than b"
End If
</script>
</body>
</html>
执行上述代码后,将生成以下结果 −
a is Greater than b
vbscript_decisions.htm
广告