asp程序中我想让图片新闻显示为两行,怎样修改代码?
源代码如下:<%pro_list="<tablewidth=""100%""border=""0""cellspacing=""0""cellpadding=""0"">...
源代码如下:
<%
pro_list="<table width=""100%"" border=""0"" cellspacing=""0"" cellpadding=""0"">"
pro_list=pro_list&" <tr>"
set rs=server.CreateObject("adodb.recordset")
rs.open "select top 4 title,img,html from products order by id desc",conn,1,1
if not rs.eof then
do while not rs.eof
pro_list=pro_list&" <td width=""25%"" align=""center""><table width=""140"" height=""110"" border=""0"" cellspacing=""0"" cellpadding=""0"">"
pro_list=pro_list&" <tr>"
pro_list=pro_list&" <td align=""center"" class=""d_l_border_3""><a href=""html/"&rs("html")&""" target=""_blank""><img src=""uploadimg/img/"&rs
("img")&""" width=""140"" height=""110"" border=""0""></a></td>"
pro_list=pro_list&" </tr>"
pro_list=pro_list&" <tr>"
pro_list=pro_list&" <td height=""30"" align=""center""><a href=""html/"&rs("html")&""" target=""_blank"">"&left(rs("title"),10)&"</a></td>"
pro_list=pro_list&" </tr>"
pro_list=pro_list&" </table></td>"
rs.movenext
if rs.eof then exit do
loop
end if
rs.close
set rs=nothing
pro_list=pro_list&" </tr>"
pro_list=pro_list&"</table>"
conn.close
set conn=nothing
%>
document.write('<%=pro_list%>')
以上选了前4个图片新闻,我想选前8个新闻排列为两排
谢谢
谢谢 lzp4881 少侠
你的答案我换到网页中还是不行,没有显示了,原来的义拍个图片也看不到了,麻烦你帮我看看是什么原因? 展开
<%
pro_list="<table width=""100%"" border=""0"" cellspacing=""0"" cellpadding=""0"">"
pro_list=pro_list&" <tr>"
set rs=server.CreateObject("adodb.recordset")
rs.open "select top 4 title,img,html from products order by id desc",conn,1,1
if not rs.eof then
do while not rs.eof
pro_list=pro_list&" <td width=""25%"" align=""center""><table width=""140"" height=""110"" border=""0"" cellspacing=""0"" cellpadding=""0"">"
pro_list=pro_list&" <tr>"
pro_list=pro_list&" <td align=""center"" class=""d_l_border_3""><a href=""html/"&rs("html")&""" target=""_blank""><img src=""uploadimg/img/"&rs
("img")&""" width=""140"" height=""110"" border=""0""></a></td>"
pro_list=pro_list&" </tr>"
pro_list=pro_list&" <tr>"
pro_list=pro_list&" <td height=""30"" align=""center""><a href=""html/"&rs("html")&""" target=""_blank"">"&left(rs("title"),10)&"</a></td>"
pro_list=pro_list&" </tr>"
pro_list=pro_list&" </table></td>"
rs.movenext
if rs.eof then exit do
loop
end if
rs.close
set rs=nothing
pro_list=pro_list&" </tr>"
pro_list=pro_list&"</table>"
conn.close
set conn=nothing
%>
document.write('<%=pro_list%>')
以上选了前4个图片新闻,我想选前8个新闻排列为两排
谢谢
谢谢 lzp4881 少侠
你的答案我换到网页中还是不行,没有显示了,原来的义拍个图片也看不到了,麻烦你帮我看看是什么原因? 展开
1个回答
展开全部
<%
pro_list="<table width=""100%"" border=""0"" cellspacing=""0"" cellpadding=""0"">"
pro_list=pro_list&" <tr>"
set rs=server.CreateObject("adodb.recordset")
rs.open "select top 8 title,img,html from products order by id desc",conn,1,1
if not rs.eof then
i=1
do while not rs.eof
pro_list=pro_list&" <td width=""25%"" align=""center""><table width=""140"" height=""110"" border=""0"" cellspacing=""0"" cellpadding=""0"">"
pro_list=pro_list&" <tr>"
pro_list=pro_list&" <td align=""center"" class=""d_l_border_3""><a href=""html/"&rs("html")&""" target=""_blank""><img src=""uploadimg/img/"&rs("img")&""" width=""140"" height=""110"" border=""0""></a></td>"
pro_list=pro_list&" </tr>"
pro_list=pro_list&" <tr>"
pro_list=pro_list&" <td height=""30"" align=""center""><a href=""html/"&rs("html")&""" target=""_blank"">"&left(rs("title"),10)&"</a></td>"
pro_list=pro_list&" </tr>"
pro_list=pro_list&" </table></td>"
i=i+1
if i=5 then pro_list=pro_list&" </tr><tr>"
rs.movenext
if rs.eof then exit do
loop
end if
rs.close
set rs=nothing
pro_list=pro_list&" </tr>"
pro_list=pro_list&"</table>"
conn.close
set conn=nothing
%>
document.write('<%=pro_list%>')
-----------------
没有问题的,我已经测试通过了,下面是我测试代码,不过我没有测试js调用,应该也没问题的。
<!--#include file="asp/conn.asp"-->
<%
openconn()
dim pro_list
pro_list="<table width='100%' border='0' cellspacing='0' cellpadding='0'>"
pro_list=pro_list&" <tr>"
set rs=server.CreateObject("adodb.recordset")
rs.open "select top 8 * from [admin] order by id desc",conn,1,1
if not rs.eof then
dim j:j=1
do while not rs.eof
pro_list=pro_list&" <td width=""25%"" align=""center""><table width=""140"" height=""110"" border=""0"" cellspacing=""0"" cellpadding=""0"">"
pro_list=pro_list&" <tr>"
pro_list=pro_list&" <td align=""center"" class=""d_l_border_3""><a href=""html/"&rs("username")&""" target=""_blank""><img src=""uploadimg/img/"&rs("username")&""" width=""140"" height=""110"" border=""0""></a></td>"
pro_list=pro_list&" </tr>"
pro_list=pro_list&" <tr>"
pro_list=pro_list&" <td height=""30"" align=""center""><a href=""html/"&rs("username")&""" target=""_blank"">"&left(rs("username"),10)&"</a></td>"
pro_list=pro_list&" </tr>"
pro_list=pro_list&" </table></td>"
j=j+1
if j=5 then pro_list=pro_list&" </tr><tr>"
rs.movenext
if rs.eof then exit do
loop
end if
rs.close
set rs=nothing
pro_list=pro_list&" </tr>"
pro_list=pro_list&"</table>"
conn.close
set conn=nothing
response.write pro_list
%>
pro_list="<table width=""100%"" border=""0"" cellspacing=""0"" cellpadding=""0"">"
pro_list=pro_list&" <tr>"
set rs=server.CreateObject("adodb.recordset")
rs.open "select top 8 title,img,html from products order by id desc",conn,1,1
if not rs.eof then
i=1
do while not rs.eof
pro_list=pro_list&" <td width=""25%"" align=""center""><table width=""140"" height=""110"" border=""0"" cellspacing=""0"" cellpadding=""0"">"
pro_list=pro_list&" <tr>"
pro_list=pro_list&" <td align=""center"" class=""d_l_border_3""><a href=""html/"&rs("html")&""" target=""_blank""><img src=""uploadimg/img/"&rs("img")&""" width=""140"" height=""110"" border=""0""></a></td>"
pro_list=pro_list&" </tr>"
pro_list=pro_list&" <tr>"
pro_list=pro_list&" <td height=""30"" align=""center""><a href=""html/"&rs("html")&""" target=""_blank"">"&left(rs("title"),10)&"</a></td>"
pro_list=pro_list&" </tr>"
pro_list=pro_list&" </table></td>"
i=i+1
if i=5 then pro_list=pro_list&" </tr><tr>"
rs.movenext
if rs.eof then exit do
loop
end if
rs.close
set rs=nothing
pro_list=pro_list&" </tr>"
pro_list=pro_list&"</table>"
conn.close
set conn=nothing
%>
document.write('<%=pro_list%>')
-----------------
没有问题的,我已经测试通过了,下面是我测试代码,不过我没有测试js调用,应该也没问题的。
<!--#include file="asp/conn.asp"-->
<%
openconn()
dim pro_list
pro_list="<table width='100%' border='0' cellspacing='0' cellpadding='0'>"
pro_list=pro_list&" <tr>"
set rs=server.CreateObject("adodb.recordset")
rs.open "select top 8 * from [admin] order by id desc",conn,1,1
if not rs.eof then
dim j:j=1
do while not rs.eof
pro_list=pro_list&" <td width=""25%"" align=""center""><table width=""140"" height=""110"" border=""0"" cellspacing=""0"" cellpadding=""0"">"
pro_list=pro_list&" <tr>"
pro_list=pro_list&" <td align=""center"" class=""d_l_border_3""><a href=""html/"&rs("username")&""" target=""_blank""><img src=""uploadimg/img/"&rs("username")&""" width=""140"" height=""110"" border=""0""></a></td>"
pro_list=pro_list&" </tr>"
pro_list=pro_list&" <tr>"
pro_list=pro_list&" <td height=""30"" align=""center""><a href=""html/"&rs("username")&""" target=""_blank"">"&left(rs("username"),10)&"</a></td>"
pro_list=pro_list&" </tr>"
pro_list=pro_list&" </table></td>"
j=j+1
if j=5 then pro_list=pro_list&" </tr><tr>"
rs.movenext
if rs.eof then exit do
loop
end if
rs.close
set rs=nothing
pro_list=pro_list&" </tr>"
pro_list=pro_list&"</table>"
conn.close
set conn=nothing
response.write pro_list
%>
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询