一个如果语句包括布尔表达式后跟一个或多个语句。如果说条件为True,则执行If条件下的语句。如果条件被认为是False,则将执行其他部分下的语句。
语法
T 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
作者:terry,如若转载,请注明出处:https://www.web176.com/vbscript/1288.html
支付宝
微信