奇怪的< img>封装在IF中时的标记行为 [英] Strange <img> tag behaviour when encapsulated in IF

查看:75
本文介绍了奇怪的< img>封装在IF中时的标记行为的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

vbscript


任何人都可以帮我弄清楚为什么这个IF语句中的图像显示

作为占位符当声明为

返回true时,而不是图像本身?


如果我删除IF图像显示...

<%

If(events.Fields.Item(" picURL")。Value)<> ""然后

%>

< img src ="<%=(events.Fields.Item(" picURL")。Value)%>" ; ALT" name =" pic"

border =" 1

<%

结束如果

%> ;


对我毫无意义......我想要的是显示一个图像,如果有一个URL

可用,如果没有则。


欢呼,

GP ​​

解决方案

语法错误。(缺少dohble-quotes)。


<%

If(events.Fields.Item(" picURL")。Value) <> ""然后

%>

< img src ="<%= events.Fields.Item(" picURL")。Value%>" alt =" URL:

<%= events.Fields.Item(" picURL")。Value%>"命名= QUOT; PIC" border =" 1">

<%

结束如果

%>


将鼠标悬停在图片上以查看工具提示中的网址(如果不需要
则移除)。


Chris。


" Gianpiero Colagiacomo" < gp@1lg.com>在消息中写道

news:en ************** @ tk2msftngp13.phx.gbl ...

vbscript

任何人都可以帮我弄清楚为什么当IF语句返回true时,这个IF语句中的图像显示为占位符而不是图像本身?

如果我删除图像显示的IF ...

<%
If(events.Fields.Item(" picURL")。Value) <> ""然后
%>
< img src ="<%=(events.Fields.Item(" picURL")。Value)%>" ALT" name =" pic"
border =" 1
<%
结束如果
%>

对我毫无意义.. 。我想要的只是显示一个图像,如果有一个URL
可用,如果没有,那就没有了。

干杯,

GP


图像的路径是什么?它是否有效,因为它被退回?


雷在家


Gianpiero Colagiacomo < gp@1lg.com>在消息中写道

news:en ************** @ tk2msftngp13.phx.gbl ...

vbscript

任何人都可以帮我弄清楚为什么当IF语句返回true时,这个IF语句中的图像显示为占位符而不是图像本身?

如果我删除图像显示的IF ...

<%
If(events.Fields.Item(" picURL")。Value) <> ""然后
%>
< img src ="<%=(events.Fields.Item(" picURL")。Value)%>" ALT" name =" pic"
border =" 1
<%
结束如果
%>

对我毫无意义.. 。我想要的只是显示一个图像,如果有一个URL
可用,如果没有,那就没有了。

干杯,

GP


也许该字段不是" (一个空字符串)但是Null

你试过IsNull还是IsEmpty?


如果那不起作用试试:


myfield = events.Fields.Item(" picURL")。Value& "

如果myfield<> ""然后

....


希望有用......告诉我们! ;-)

" Gianpiero Colagiacomo" < gp@1lg.com>在消息中写道

news:en ************** @ tk2msftngp13.phx.gbl ...

vbscript

任何人都可以帮我弄清楚为什么当IF语句返回true时,这个IF语句中的图像显示为占位符而不是图像本身?

如果我删除图像显示的IF ...

<%
If(events.Fields.Item(" picURL")。Value) <> ""然后
%>
< img src ="<%=(events.Fields.Item(" picURL")。Value)%>" ALT" name =" pic"
border =" 1
<%
结束如果
%>

对我毫无意义.. 。我想要的只是显示一个图像,如果有一个URL
可用,如果没有,那就没有了。

干杯,

GP


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

解决方案

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



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



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



这篇关于奇怪的&lt; img&gt;封装在IF中时的标记行为的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆