473,399 Members | 3,656 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

Strange <img> tag behaviour when encapsulated in IF

vbscript:

Can anyone help me figure out why the image within this IF statement shows
as a place holder rather than the image itself when the statement is
returning true?

If I remove the IF the image shows...

<%
If (events.Fields.Item("picURL").Value) <> "" Then
%>
<img src="<%=(events.Fields.Item("picURL").Value)%>" alt" name="pic"
border="1
<%
End If
%>

Makes no sense to me... All I want is to show an image if there is a URL
available and nothing if not.

Cheers,

GP

Jul 19 '05 #1
10 2331
Syntax was incorrect.(missing dohble-quotes).

<%
If (events.Fields.Item("picURL").Value) <> "" Then
%>
<img src="<%=events.Fields.Item("picURL").Value%>" alt="URL:
<%=events.Fields.Item("picURL").Value%>" name="pic" border="1">
<%
End If
%>

Hold your mouse over the picture to see the url in the tooltip (remove if
not needed).

Chris.

"Gianpiero Colagiacomo" <gp@1lg.com> wrote in message
news:en**************@tk2msftngp13.phx.gbl...
vbscript:

Can anyone help me figure out why the image within this IF statement shows
as a place holder rather than the image itself when the statement is
returning true?

If I remove the IF the image shows...

<%
If (events.Fields.Item("picURL").Value) <> "" Then
%>
<img src="<%=(events.Fields.Item("picURL").Value)%>" alt" name="pic"
border="1
<%
End If
%>

Makes no sense to me... All I want is to show an image if there is a URL
available and nothing if not.

Cheers,

GP

Jul 19 '05 #2
What's the path to the image? Is it valid as it is returned?

Ray at home

"Gianpiero Colagiacomo" <gp@1lg.com> wrote in message
news:en**************@tk2msftngp13.phx.gbl...
vbscript:

Can anyone help me figure out why the image within this IF statement shows
as a place holder rather than the image itself when the statement is
returning true?

If I remove the IF the image shows...

<%
If (events.Fields.Item("picURL").Value) <> "" Then
%>
<img src="<%=(events.Fields.Item("picURL").Value)%>" alt" name="pic"
border="1
<%
End If
%>

Makes no sense to me... All I want is to show an image if there is a URL
available and nothing if not.

Cheers,

GP

Jul 19 '05 #3
Maybe the field isn't "" (an empty string) but rather Null
did you try IsNull or IsEmpty?

If that doesn't work try:

myfield = events.Fields.Item("picURL").Value & ""
If myfield <> "" Then
....

Hope that works... let us know! ;-)
"Gianpiero Colagiacomo" <gp@1lg.com> wrote in message
news:en**************@tk2msftngp13.phx.gbl...
vbscript:

Can anyone help me figure out why the image within this IF statement shows
as a place holder rather than the image itself when the statement is
returning true?

If I remove the IF the image shows...

<%
If (events.Fields.Item("picURL").Value) <> "" Then
%>
<img src="<%=(events.Fields.Item("picURL").Value)%>" alt" name="pic"
border="1
<%
End If
%>

Makes no sense to me... All I want is to show an image if there is a URL
available and nothing if not.

Cheers,

GP

Jul 19 '05 #4
Gianpiero Colagiacomo wrote on 05 jul 2003 in
microsoft.public.inetserver.asp.general:
vbscript:

Can anyone help me figure out why the image within this IF statement
shows as a place holder rather than the image itself when the
statement is returning true?

If I remove the IF the image shows...

<%
If (events.Fields.Item("picURL").Value) <> "" Then
%>
<img src="<%=(events.Fields.Item("picURL").Value)%>" alt"
name="pic"
border="1
<%
End If
%>

Makes no sense to me... All I want is to show an image if there is a
URL available and nothing if not.


You are right, this makes no sense:

Serverside does not understand "(events.Fields.Item("picURL").Value)",
because asp has no events. [And why the outer (), btw]
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 19 '05 #5
fist off, to test use might as well throw away the if then part of your
rstatement.

That leaves -

<img src="<%=(events.Fields.Item("picURL").Value)%>" alt" name="pic"
border="1

1. You have no closing >
2. Your alt is screwey - it should be alt="something" or no alt at all
3. Third, your border ="1 is wrong
4. the page is trying to interperet <img = gobledygook

"Gianpiero Colagiacomo" <gp@1lg.com> wrote in message
news:en**************@tk2msftngp13.phx.gbl...
vbscript:

Can anyone help me figure out why the image within this IF statement shows
as a place holder rather than the image itself when the statement is
returning true?

If I remove the IF the image shows...

<%
If (events.Fields.Item("picURL").Value) <> "" Then
%>
<img src="<%=(events.Fields.Item("picURL").Value)%>" alt" name="pic"
border="1
<%
End If
%>

Makes no sense to me... All I want is to show an image if there is a URL
available and nothing if not.

Cheers,

GP

Jul 19 '05 #6
'Events' is a recordset name. The outer () was placed there by Dreamweaver,
not me!

"Evertjan." <ex**************@interxnl.net> wrote in message
news:Xn********************@194.109.133.29...
Gianpiero Colagiacomo wrote on 05 jul 2003 in
microsoft.public.inetserver.asp.general:
vbscript:

Can anyone help me figure out why the image within this IF statement
shows as a place holder rather than the image itself when the
statement is returning true?

If I remove the IF the image shows...

<%
If (events.Fields.Item("picURL").Value) <> "" Then
%>
<img src="<%=(events.Fields.Item("picURL").Value)%>" alt"
name="pic"
border="1
<%
End If
%>

Makes no sense to me... All I want is to show an image if there is a
URL available and nothing if not.


You are right, this makes no sense:

Serverside does not understand "(events.Fields.Item("picURL").Value)",
because asp has no events. [And why the outer (), btw]
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

Jul 19 '05 #7
Path valid. Without the if the image displays.

"Ray at <%=sLocation%>" <ra*@ajf8jalskdfna.sefrhja7yasdf.com> wrote in
message news:ei**************@tk2msftngp13.phx.gbl...
What's the path to the image? Is it valid as it is returned?

Ray at home

"Gianpiero Colagiacomo" <gp@1lg.com> wrote in message
news:en**************@tk2msftngp13.phx.gbl...
vbscript:

Can anyone help me figure out why the image within this IF statement shows as a place holder rather than the image itself when the statement is
returning true?

If I remove the IF the image shows...

<%
If (events.Fields.Item("picURL").Value) <> "" Then
%>
<img src="<%=(events.Fields.Item("picURL").Value)%>" alt" name="pic" border="1
<%
End If
%>

Makes no sense to me... All I want is to show an image if there is a URL available and nothing if not.

Cheers,

GP


Jul 19 '05 #8
Yeah, sorry that was me trying to trim down the html for the newsgroup. It
actually looks like this:

<%
If (events.Fields.Item("picURL").Value) <> "" Then
%>
<TD> <div align="center">
<img src="<%=(events.Fields.Item("picURL").Value)%>"
alt="<%=(events.Fields.Item("name").Value)%>" name="pic"
border="1"></div></TD>
<%
End If
%>

Cheers,

GP
"Chris Barber" <ch***@blue-canoe.co.uk.NOSPAM> wrote in message
news:uo**************@tk2msftngp13.phx.gbl...
Syntax was incorrect.(missing dohble-quotes).

<%
If (events.Fields.Item("picURL").Value) <> "" Then
%>
<img src="<%=events.Fields.Item("picURL").Value%>" alt="URL:
<%=events.Fields.Item("picURL").Value%>" name="pic" border="1">
<%
End If
%>

Hold your mouse over the picture to see the url in the tooltip (remove if
not needed).

Chris.

"Gianpiero Colagiacomo" <gp@1lg.com> wrote in message
news:en**************@tk2msftngp13.phx.gbl...
vbscript:

Can anyone help me figure out why the image within this IF statement shows as a place holder rather than the image itself when the statement is
returning true?

If I remove the IF the image shows...

<%
If (events.Fields.Item("picURL").Value) <> "" Then
%>
<img src="<%=(events.Fields.Item("picURL").Value)%>" alt" name="pic" border="1
<%
End If
%>

Makes no sense to me... All I want is to show an image if there is a URL available and nothing if not.

Cheers,

GP


Jul 19 '05 #9
This is fixed. Problem was that the recordset 'events' had a cursortype of
'forward only'. I changed this to 'static' and it works perfectly.

Cheers,

GP
"Gianpiero Colagiacomo" <gp@1lg.com> wrote in message
news:en**************@tk2msftngp13.phx.gbl...
vbscript:

Can anyone help me figure out why the image within this IF statement shows
as a place holder rather than the image itself when the statement is
returning true?

If I remove the IF the image shows...

<%
If (events.Fields.Item("picURL").Value) <> "" Then
%>
<img src="<%=(events.Fields.Item("picURL").Value)%>" alt" name="pic"
border="1
<%
End If
%>

Makes no sense to me... All I want is to show an image if there is a URL
available and nothing if not.

Cheers,

GP

Jul 19 '05 #10
Gianpiero Colagiacomo wrote on 05 jul 2003 in
microsoft.public.inetserver.asp.general:
'Events' is a recordset name. The outer () was placed there by
Dreamweaver, not me!

Roger. [= received as sent]

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 19 '05 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
by: Philipp Lenssen | last post by:
My friend has the following problem (background: we want to transform XML to XHTML via XSLT): "We copy XHTML fragments into an output by using the following template: <xsl:template match="*"...
5
by: MyndPhlyp | last post by:
I've been busting my head trying to figure this out for quite some time. With IE6 and NS7, no problems. I can simply code the HTML <img height="100%"> and be done with it. But NS4 and NS6 (and...
15
by: Gérard Talbot | last post by:
Hello all, I'd like to know and understand the difference between, say, <img src="/ImageFilename.png" width="123" height="456" alt=""> and <img src="/ImageFilename.png" style="width:...
4
by: Jim Moe | last post by:
Hello, Mozilla (suite and Firefox) ignore the height and width attributes of <img> when the image itself is unavailable (404); only enough space is allocated for the alt text. Is this expected...
3
by: Henry Johnson | last post by:
Okay - I'm spinning my wheels on this one... can someone help me figure out how to programmatically populate a table cell as follows (from C# code-behind)? I've tried using a Literal control in the...
1
by: Carl | last post by:
Hi all I have a javascript function that drags and drops an element (ie img) into a container (ie bordered div). The function works and returns the element and and container. My next step is to...
4
by: SammyBar | last post by:
Hi all, I wonder is it possible to upload the content of an <imgfield to a server. The content of the <imgwas downloaded from a web site different from the one it should be uploaded. The image...
17
by: biju | last post by:
It is very common to see an image as a link on many web pages. Authors create them by putting an <imgtag inside a <atag. This is very much extra use of another tag. But why browsers dont support...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.