隐藏字段if语句为true或false

时间:2014-07-21 11:31:51

标签: asp-classic

我在页面上有两个按钮,我想要显示一个记录集中的语句是否为真,否则隐藏为false。例如,如果answer = boy,则显示按钮应该显示,否则显示按钮应该显示。

<input type="submit"  name="button3" id="button3" value="Show" />

<input type="submit"  name="button3" id="button3" value="Don't Show" />

2 个答案:

答案 0 :(得分:1)

Zam说得对。不过,我会这样写,因为它更容易修改:

<%
s_caption = "Do not Show"
if s_answer = "boy" then s_caption = "Show"
response.write ("<input type='submit'  name='button3' id='button3' value='" & s_caption & "' />")
%>

答案 1 :(得分:0)

<input type="submit"  name="button3" id="button3" value="<% If oRs("FieldName") = True Then Response.Write "Show" Else Response.Write "Do not show" End If %>" />