|
|||||||
| ASP Discussion and technical support for using and deploying Active Server Pages. |
![]() |
|
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
How do I show or hide DIV based on ASP field value?
Hi,
I have created a user form in which visitors can fill in sections, some of which are hidden or displayed using the onclick to trigger a DIV to display or hide then submit the results to a database using ASP. All works fine with that, however... I have created another page which retrieves the results for an individual's form submission, and I want to hide the sections that were not completed (hidden when submitted). How can I get my page to hide or show DIVs, depending on the value retrieved from a particular field within the database? i.e. if Question1Response="A", show Div ID="A Section" If Question1Response="B", show Div ID="B Section" etc. Hope this makes sense. Any help would be gratefully received. Thanks, Low Society |
|
#2
|
||||
|
||||
|
Code:
<%
function showDiv(ans)
if Question1Response = ans then
showDiv = "inline" ' or block
else
showDiv = "none"
end function %>
<div id="A_Section" style="display: <%=showDiv("A")%>">
...
</div>
|
|
#3
|
|||
|
|||
|
Thank you
Thank you very much for your help. I won't get the opportunity to try your solution until next week, but I'm encouraged by your suggested solution to my problem.
I really appreciate your help. Thanks again, Gary |
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|