3.2.0

hiding / activating a hyperlink from database query

Hi,

I'm trying to make a link in a database query hidden if there's no data available, yet visible if there is data.

I'm doing a search on a database, some items have images, some don't.

Here's my results page code:
<td width="5%"><a href="../images/catalog/<%=(Recordset1.Fields.Item("SPC").Value)%>.jpg" onclick="newWindow(this.href, 'popup', 325, 300, 1, 1, 0, 0, 0, 1, 0); return false;" target="_blank">Image</a></td>


As you can see it pops a new window from the SPC number. What I'm looking for is, if there's no data in field image then the code for the link wouldn't be active.

Any ideas?

Thanks
Lonnie Hull
June 19,
I would add some logic right before that line

Check if the image is blank, if so, remove the onclick and the link, otherwise keep the code the same.
Tony
June 19,
Tony,

I guess that's where I'm having a problem. Would that logic be done in Javascript, or HTML?
I would assume that it would have to be done in Javascript, but can I just add the script to the body or would I have to have it created in the head?

This is what I was trying to do with it in the body to no avail.
<td width="5%"><div align="center"><a target="_blank" href="../../pages/PDF/<%=(Recordset1.Fields.Item("CatPage").Value)%>_806.pdf"> <%=(Recordset1.Fields.Item("CatPage").Value)%></a></div></td>
    <script type="text/javascript">
    var Image = <%=(Recordset1.Fields.Item("SPC").Value)%>
    if <%=(Recordset1.Fields.Item("SPC").Value)%> = "803867" {
        <td width="5%"><a href= "javascript:Image">Image</a></td>;
        }
    Else {
        <td width="5%"></td>;
        }
    </script>
    
  </tr>

The first line is the page of the catalog that the item is on, then I tried to create a script before the SPC. Here I was just doing some testing with a definite value, which didn't work.
Do you have a little more insight on what you were thinking?

Thanks.
Lonnie Hull
June 19,

This topic is archived.

See also:


Back to support forum