请教 asp输出图片的问题

来源:百度知道 编辑:UC知道 时间:2024/05/15 17:43:30
代码:
<%
if owen1<>"" and owen2<>"" then
sql="select * from NEWS where BigClassName='"& owen1 &"' and SmallClassName='"& owen2 &"' order by id desc"
set rs=conn.execute(sql)
if rs("firstImageName")<>"" then 'firstImageName是放置图片的字段
pic=rs("firstImageName")
else
pic=""
end if
%>
javastr=javastr+"<tr>"
<%
do while not rs.eof
%>
javastr=javastr+"<td height=\"24\" width=\"100\" style=\"BORDER-bottom: #999999 1px dotted\"> <span style=\"font-size:9pt;line-height:15pt\"> <a href=\"onews.asp?id=<%=rs("id")%>\" title=\"<%=rs("title")%>\" target=\"_blank\">

<

咋的?
不知道你在数据库里保存的是不是图片的相对路径?
如果是的话,那就可以这样写:
<img src=<%=rs("firstImageName")%> >
一定要保证该网页能找到图片所在的位置(不要用绝对路径).

如果图片a.gif与该网页在同一目录上,那在数据库里保存路径为"a.gif"
如果图片a.gif在该网页所在的目录下的tt目录下:刚数据库里保存的路径为:"tt/a.gif"
仅供参考