asp 图片新闻 修改为分两列三行显示
这是源文件<!--#includefile="conn.asp"--><html><head><title>图片新闻</title><metahttp-equiv="Co...
这是源文件
<!--#include file="conn.asp"-->
<html>
<head>
<title>图片新闻</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" type="text/css" href="css.css">
</head>
<body>
<%
sql="select top 6 * from NEWS where firstImageName<>'' and ok=true order by ID DESC"
set rs=conn.execute(sql)
if not Rs.eof then
do while not rs.eof and not rs.bof
%>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td align="center"><a href="onews.asp?id=<%=rs("id")%>" target="_blank" ><img src="uppic/<%=trim(rs("firstImageName"))%>" width="150" height="180" border="0"></a></td>
</tr>
<tr>
<td height="25" align="center"><a href="onews.asp?id=<%=rs("id")%>" target="_blank" ><%=left(rs("title"),12)%></a></td>
</tr>
</table>
<%
rs.movenext
loop
else
response.write "<tr><td align=center colspan=2 bgcolor=#E8E8F4>尚无收录</td></tr>"
end if
rs.close
set conn=nothing
%>
</body>
</html>
不管用呢 提示“Microsoft VBScript 编译器错误 '800a040e'
'loop' 语句缺少 'do'
\2.asp, line 46
” 展开
<!--#include file="conn.asp"-->
<html>
<head>
<title>图片新闻</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" type="text/css" href="css.css">
</head>
<body>
<%
sql="select top 6 * from NEWS where firstImageName<>'' and ok=true order by ID DESC"
set rs=conn.execute(sql)
if not Rs.eof then
do while not rs.eof and not rs.bof
%>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td align="center"><a href="onews.asp?id=<%=rs("id")%>" target="_blank" ><img src="uppic/<%=trim(rs("firstImageName"))%>" width="150" height="180" border="0"></a></td>
</tr>
<tr>
<td height="25" align="center"><a href="onews.asp?id=<%=rs("id")%>" target="_blank" ><%=left(rs("title"),12)%></a></td>
</tr>
</table>
<%
rs.movenext
loop
else
response.write "<tr><td align=center colspan=2 bgcolor=#E8E8F4>尚无收录</td></tr>"
end if
rs.close
set conn=nothing
%>
</body>
</html>
不管用呢 提示“Microsoft VBScript 编译器错误 '800a040e'
'loop' 语句缺少 'do'
\2.asp, line 46
” 展开
2个回答
展开全部
<!--#include file="conn.asp"-->
<html>
<head>
<title>图片新闻</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" type="text/css" href="css.css">
</head>
<body>
<%
sql="select top 6 * from NEWS where firstImageName<>'' and ok=true order by ID DESC"
set rs=conn.execute(sql)
if not Rs.eof then
%>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<%
i=1
do while not rs.eof and not rs.bof
if i mod 2=1 then
%>
<tr>
<td align="center">
<table width="150" border="0" cellpadding="0" cellspacing="0">
<tr>
<td align="center"><a href="onews.asp?id=<%=rs("id")%>" target="_blank" ><img src="uppic/<%=trim(rs("firstImageName"))%>" width="150" height="180" border="0"></a></td>
</tr>
<tr>
<td height="25" align="center"><a href="onews.asp?id=<%=rs("id")%>" target="_blank" ><%=left(rs("title"),12)%></a></td>
</tr>
</table>
</td>
<%else%>
<td align="center">
<table width="150" border="0" cellpadding="0" cellspacing="0">
<tr>
<td align="center"><a href="onews.asp?id=<%=rs("id")%>" target="_blank" ><img src="uppic/<%=trim(rs("firstImageName"))%>" width="150" height="180" border="0"></a></td>
</tr>
<tr>
<td height="25" align="center"><a href="onews.asp?id=<%=rs("id")%>" target="_blank" ><%=left(rs("title"),12)%></a></td>
</tr>
</table>
</td></tr>
<%
rs.movenext
i=i+1
loop
'跳出循环时如果i为双数,说明记录数为单,应该补上一个空白单元格
if i mod 2=0 then
%>
<td> </td></tr>
<%end if%>
</table>
<%
else
response.write "<table width='100%' border='0' cellpadding='0' cellspacing='0'><tr><td align=center colspan=2 bgcolor=#E8E8F4>尚无收录</td></tr></table>"
end if
rs.close
set conn=nothing
%>
</body>
</html>
<html>
<head>
<title>图片新闻</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" type="text/css" href="css.css">
</head>
<body>
<%
sql="select top 6 * from NEWS where firstImageName<>'' and ok=true order by ID DESC"
set rs=conn.execute(sql)
if not Rs.eof then
%>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<%
i=1
do while not rs.eof and not rs.bof
if i mod 2=1 then
%>
<tr>
<td align="center">
<table width="150" border="0" cellpadding="0" cellspacing="0">
<tr>
<td align="center"><a href="onews.asp?id=<%=rs("id")%>" target="_blank" ><img src="uppic/<%=trim(rs("firstImageName"))%>" width="150" height="180" border="0"></a></td>
</tr>
<tr>
<td height="25" align="center"><a href="onews.asp?id=<%=rs("id")%>" target="_blank" ><%=left(rs("title"),12)%></a></td>
</tr>
</table>
</td>
<%else%>
<td align="center">
<table width="150" border="0" cellpadding="0" cellspacing="0">
<tr>
<td align="center"><a href="onews.asp?id=<%=rs("id")%>" target="_blank" ><img src="uppic/<%=trim(rs("firstImageName"))%>" width="150" height="180" border="0"></a></td>
</tr>
<tr>
<td height="25" align="center"><a href="onews.asp?id=<%=rs("id")%>" target="_blank" ><%=left(rs("title"),12)%></a></td>
</tr>
</table>
</td></tr>
<%
rs.movenext
i=i+1
loop
'跳出循环时如果i为双数,说明记录数为单,应该补上一个空白单元格
if i mod 2=0 then
%>
<td> </td></tr>
<%end if%>
</table>
<%
else
response.write "<table width='100%' border='0' cellpadding='0' cellspacing='0'><tr><td align=center colspan=2 bgcolor=#E8E8F4>尚无收录</td></tr></table>"
end if
rs.close
set conn=nothing
%>
</body>
</html>
展开全部
<!--#include file="conn.asp"-->
<html>
<head>
<title>图片新闻</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" type="text/css" href="css.css">
</head>
<body>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<%
sql="select top 3 * from NEWS where firstImageName<>'' and ok=true order by ID DESC"
set rs=conn.execute(sql)
if not Rs.eof then
do while not rs.eof and not rs.bof
%>
<tr>
<td align="center"><a href="onews.asp?id=<%=rs("id")%>" target="_blank" ><img src="uppic/<%=trim(rs("firstImageName"))%>" width="150" height="180" border="0"></a></td>
<td height="25" align="center"><a href="onews.asp?id=<%=rs("id")%>" target="_blank" ><%=left(rs("title"),12)%></a></td>
</tr><%
rs.movenext
loop
else
response.write "<tr><td align=center colspan=2 bgcolor=#E8E8F4>尚无收录</td></tr>"
end if
rs.close
set conn=nothing
%>
</table>
</body>
</html>
<html>
<head>
<title>图片新闻</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" type="text/css" href="css.css">
</head>
<body>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<%
sql="select top 3 * from NEWS where firstImageName<>'' and ok=true order by ID DESC"
set rs=conn.execute(sql)
if not Rs.eof then
do while not rs.eof and not rs.bof
%>
<tr>
<td align="center"><a href="onews.asp?id=<%=rs("id")%>" target="_blank" ><img src="uppic/<%=trim(rs("firstImageName"))%>" width="150" height="180" border="0"></a></td>
<td height="25" align="center"><a href="onews.asp?id=<%=rs("id")%>" target="_blank" ><%=left(rs("title"),12)%></a></td>
</tr><%
rs.movenext
loop
else
response.write "<tr><td align=center colspan=2 bgcolor=#E8E8F4>尚无收录</td></tr>"
end if
rs.close
set conn=nothing
%>
</table>
</body>
</html>
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询