Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Use javascript IF statement to display HTML tags

Status
Not open for further replies.

anpfire

Programmer
Oct 8, 2003
22
CA
Hi,
I am creating a dynamic table and would like to display a hyperlink depending on whether or not there is a value in the database.

This is the code I have:
<table border=&quot;1&quot; bordercolor=&quot;#417A98&quot; width=&quot;350&quot; align=&quot;center&quot;>
<% while ((Repeat1__numRows-- != 0) && (!Rset.EOF)) { %>
<tr>
<td><%=(Rset.Fields.Item(&quot;Authors&quot;).Value)%>&nbsp;</td>
<td><%=(Rset.Fields.Item(&quot;Title&quot;).Value)%>&nbsp;</td>

<td><a href=&quot;<%=(Rset.Fields.Item(&quot;Link&quot;).Value)%>&quot; target=&quot;_blank&quot;>
<%
if ((Rset.Fields.Item(&quot;Link&quot;).Value) != &quot;&quot;)
%>
<%='View PDF doc'%></a></td>
</tr>
<%
Repeat1__index++;
TableRecordset.MoveNext();
}
%>
</table>

I would like to display &quot;View PDF doc&quot; as text for the hyperlink if Item(&quot;Link&quot;).Value has a value. If it has no value, nothing should be displayed. I appreciate any suggestions. Thanks.
Anoop.
 
try this:
<td>
<%
if ((Rset.Fields.Item(&quot;Link&quot;).Value) != &quot;&quot;)
%>
<a href=&quot;<%=(Rset.Fields.Item(&quot;Link&quot;).Value)%>&quot; target=&quot;_blank&quot;>
<%='View PDF doc'%></a>
<%
else
response.write &quot;&nbsp;&quot;
end if
%>
</td>


Known is handfull, Unknown is worldfull
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top