| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Problem displaying gif nested in If Statement
I am trying to get a page working that will display an email graphic if there is an email address listed and display a filler transparent image 1pixelx1pixel if there is no email address or do nothing at all. I listed the code below and hope someone can possibly help figure out the problem. I am new to ASP and just doing this for a high school class website for classmates to contact each other. I am trying to do the same thing with a globe icon also where is only displays if they list a webpage in their profile but have not put any code for that one yet. Just been trying to get the email graphic to work first.
Code: Code:
<%
Do While Not objRS.EOF
stremail = objRS("Email")
%>
<tr>
<td width="15%" align="center" height="27"><%=objRS("First_Name")%></td>
<td width="20%" align="center" height="27"><%=objRS("Middle_Name")%></td>
<td width="20%" align="center" height="27"><%=objRS("Last_Name")%></td>
<td width="20%" align="center" height="27"><%=objRS("Maiden_Name")%></td>
<td width="10%" align="center" height="27">
<% If stremail = "" then Response.Write ""<a href=http://class94.mydomain.com/alumni/sendmail.asp?AlumniID=" & (objRS("id") & "><img border='0' src='/class94/alumni/email.gif' width='20' height='20'>" & "</a>""
Else Response.Write "<img border="0" src="/class94/alumni/transparent.gif" width="20" height="20" & ">"
end if%>
</td>
<td width="10%" align="center" height="27"><A HREF="<%=objRS("homepage")%>" Target="_blank">
<img border="0" src="/class94/alumni/homepage.gif" width="20" height="20"></a>
</td>
</tr>
<tr>
<td width="105%" bgcolor="#C0C0C0" colspan="6">
<hr>
</td>
</tr>
<%
iCount = iCount +1
'Move on to the next alumni
objRS.MoveNext
Loop
%>
Last edited by methenyr : July 30th, 2004 at 05:22 PM. Reason: Changed title |
|
#2
|
|||
|
|||
|
Not quite sure what your problem is, but here is a fix for part of your code. Quote marks were a bit misplaced. I'm also doing things a bit differently so I don't go crazy with the quote stuff.
Change the path in the href as necessary.Code:
<%
If stremail = "" then %>
<a href="alumni/sendmail.asp?AlumniID=<%=(objRS("id")%>"><img border=0 src="/class94/alumni/email.gif" width=20 height=20></a>
<%
Else %>
<img border="0" src="/class94/alumni/transparent.gif" width="20" height="20">
<%
end if%>
Cheers, Mike |
![]() |
| Viewing: ASP Free Forums > Programming > Code Bank > Problem displaying gif nested in If Statement |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|