如何在 IF 条件下使用变量值的值
How to use value of variable's value in IF condition
这里有一个变量"question",它的值也是可变的,就是"Q4_1",我需要根据[的那个值执行if条件=14=]。那么变量的变量值应该怎么调用呢?
question="Q4_1"
<%if (value of (=question)="1" then %>
<tr><td>Some text</td></tr>
<%end if %>
您正在寻找 Eval()
函数来计算表达式:
Dim question
Dim Q4_1
question ="Q4_1"
Q4_1 = "1"
If Eval(question) = "1" Then
Response.Write "Some text"
Else
Response.Write "Other text"
End If
此示例将 "Some text" 发送到客户端。
这里有一个变量"question",它的值也是可变的,就是"Q4_1",我需要根据[的那个值执行if条件=14=]。那么变量的变量值应该怎么调用呢?
question="Q4_1"
<%if (value of (=question)="1" then %>
<tr><td>Some text</td></tr>
<%end if %>
您正在寻找 Eval()
函数来计算表达式:
Dim question
Dim Q4_1
question ="Q4_1"
Q4_1 = "1"
If Eval(question) = "1" Then
Response.Write "Some text"
Else
Response.Write "Other text"
End If
此示例将 "Some text" 发送到客户端。