asp里表格的循环
在一空白中要每行最多三个单元格,单元格里的内容要从数据库中取出<tablewidth="100%"><tr><%a=0cols=3dowhilenotrs1.eofifa...
在一空白中要每行最多三个单元格,单元格里的内容要从数据库中取出
<table width="100%">
<tr>
<%
a=0
cols=3
do while not rs1.eof
if a mod cols=0 then response.Write("<tr >")
a=a+1
%>
<td width="17"><%set rs5=server.createobject("adodb.recordset")
rs5.open "select id,cata4id,name from cata5 where cata4id="&rs4("id")&" ",conn,1,1
if not rs5.eof then
do while not rs5.eof%></td>
<td width="21"><img src="images/fbob02.gif" width="15" height="14"></td>
<td width="599"><a href="product.asp?cata5id=<%=rs5("id")%>"><%=rs5("name")%></a>
<%rs5.movenext
loop
rs5.close
end if
%> </td>
</tr></table>
</div></td>
</tr>
</table> </td>
</tr>
</table> <%rs4.movenext
loop
rs4.close
end if
%>
<!-- product2 --><!-- product3 --><!-- product4 --><!-- product5 --></td>
<td width="25" background="images/06.jpg"></td>
</tr>
</table>
我在前面加的几行循环不行啊老提示以前的错误,那几行删掉就可以了这是什么回事啊!
这么说,把一个表格循环了,要想把他布置成一排过去三个表格 <%
a=0
cols=3
do while not rs1.eof
if a mod cols=0 then response.Write("<tr >")
a=a+1
%>
全部的代码:
太多了不让打上来
rs4也一样不行,4,5在这里是分类的意思,4是第一大类,5是他下面的子类这样子
提示说
Microsoft VBScript 编译器错误 (0x800A03F6)
缺少 'End'
在这里的错误什么改啊
<% rs4.movenext
loop
rs.close
%></table> </td>
就在这第一行,RS4.MOVENEXT 展开
<table width="100%">
<tr>
<%
a=0
cols=3
do while not rs1.eof
if a mod cols=0 then response.Write("<tr >")
a=a+1
%>
<td width="17"><%set rs5=server.createobject("adodb.recordset")
rs5.open "select id,cata4id,name from cata5 where cata4id="&rs4("id")&" ",conn,1,1
if not rs5.eof then
do while not rs5.eof%></td>
<td width="21"><img src="images/fbob02.gif" width="15" height="14"></td>
<td width="599"><a href="product.asp?cata5id=<%=rs5("id")%>"><%=rs5("name")%></a>
<%rs5.movenext
loop
rs5.close
end if
%> </td>
</tr></table>
</div></td>
</tr>
</table> </td>
</tr>
</table> <%rs4.movenext
loop
rs4.close
end if
%>
<!-- product2 --><!-- product3 --><!-- product4 --><!-- product5 --></td>
<td width="25" background="images/06.jpg"></td>
</tr>
</table>
我在前面加的几行循环不行啊老提示以前的错误,那几行删掉就可以了这是什么回事啊!
这么说,把一个表格循环了,要想把他布置成一排过去三个表格 <%
a=0
cols=3
do while not rs1.eof
if a mod cols=0 then response.Write("<tr >")
a=a+1
%>
全部的代码:
太多了不让打上来
rs4也一样不行,4,5在这里是分类的意思,4是第一大类,5是他下面的子类这样子
提示说
Microsoft VBScript 编译器错误 (0x800A03F6)
缺少 'End'
在这里的错误什么改啊
<% rs4.movenext
loop
rs.close
%></table> </td>
就在这第一行,RS4.MOVENEXT 展开
3个回答
展开全部
<!--#include file="conn.asp"-->
<!--#include file="admin_yz.asp"-->
<%
if session("Login")=false then
Response.Redirect("index.asp")
end if
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>统计</title>
<style type="text/css">
body{ margin:0; padding:0}
#scrollBox {
BORDER-RIGHT: #eeeeee 1px solid;
BORDER-TOP: #eeeeee 1px solid;
FONT-SIZE: 14px;
Z-INDEX: 2;
LEFT: 47px;
OVERFLOW: hidden;
BORDER-LEFT: #eeeeee 1px solid;
WIDTH: 325px;
BORDER-BOTTOM: #eeeeee 1px solid;
FONT-FAMILY: Arial, Helvetica, sans-serif;
POSITION: absolute;
TOP: 15px;
HEIGHT:25px;
ACKGROUND-COLOR: #eeeeee;
layer-background-color: #eeeeee;
margin-top:5px;
}
#scrollContent {
MARGIN-LEFT: 4px;
POSITION: absolute;
left: 3px;
top: 125px;
}
#content {
FONT-SIZE: 14px;
Z-INDEX: 1;
LEFT: 260px;
MARGIN-LEFT: 5px;
WIDTH: 490px;
COLOR: #000000;
MARGIN-RIGHT: 5px;
FONT-FAMILY: Arial, Helvetica, sans-serif;
POSITION: absolute;
TOP: 166px;
TEXT-DECORATION: none
}
</style>
<SCRIPT type=text/javascript>
<!--
var pos = 0;
var step = -1;
var tid;
function scrollContent () {
if (document.getElementById) {
var c = document.getElementById('scrollBox');
var s = document.getElementById('scrollContent');
pos += step;
s.style.top = pos + 'px';
if (pos < -s.offsetHeight)
pos = c.offsetHeight;
} else if (document.all) {
var c = document.all['scrollBox'];
var s = document.all['scrollContent'];
pos += step;
s.style.top = pos + 'px';
if (pos < -s.offsetHeight)
pos = c.offsetHeight;
} else if (document.layers) {
var c = document.scrollBox;
var s = c.document.scrollContent;
s.top += step;
}
}
function init () {
tid = setInterval('scrollContent()', 100);
}
//-->
</SCRIPT>
</head>
<body vLink=#666666 aLink=#3366cc link=#3366cc bgColor=#ffffff leftMargin=0 topMargin=0 onLoad="init();" rightMargin=0 marginwidth="0" marginheight="0" >
<br />
<table width="900" height="200" border="0" align="center" cellpadding="0" cellspacing="0" style="margin-top:100px; ">
<tr> <%set rs=server.createobject("adodb.recordset")
sql="select top 10 bianhao,fl from news order by bianhao desc"
rs.open sql,conn,1,3
do while not rs.eof
zongshu=zongshu+rs("bianhao")
rs.movenext
loop
rs.MoveFirst
do while not rs.eof%>
<td width="80" height="212" align="center" valign="bottom"><%=rs("bianhao")%>
<div style="height:<%=rs("bianhao")/zongshu*1000%>px; background:url(gg.jpg) repeat-x bottom; width:30px; margin:5px auto; overflow: hidden"></div>
<%=rs("title")%></td>
<%rs.movenext
loop
rs.close
set rs=nothing%>
</tr>
</table>
<!---->
<div style="position:absolute; left:50px; top:5px; font-size:14px; color:red; font-weight:bold">今日到账</div>
<DIV id=scrollBox >
<DIV id=scrollContent >
<%set rs=server.createobject("adodb.recordset")
sql="select * from news order by bianhao desc"
rs.open sql,conn,1,3
do while not rs.eof%>
<table width="250" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="left"><%=rs("title")%></td>
<td align="right"><%=rs("bianhao")%></td>
</tr>
</table>
<%rs.movenext
loop
rs.close
set rs=nothing%>
</DIV>
</DIV>
</body>
</html>
<!--#include file="admin_yz.asp"-->
<%
if session("Login")=false then
Response.Redirect("index.asp")
end if
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>统计</title>
<style type="text/css">
body{ margin:0; padding:0}
#scrollBox {
BORDER-RIGHT: #eeeeee 1px solid;
BORDER-TOP: #eeeeee 1px solid;
FONT-SIZE: 14px;
Z-INDEX: 2;
LEFT: 47px;
OVERFLOW: hidden;
BORDER-LEFT: #eeeeee 1px solid;
WIDTH: 325px;
BORDER-BOTTOM: #eeeeee 1px solid;
FONT-FAMILY: Arial, Helvetica, sans-serif;
POSITION: absolute;
TOP: 15px;
HEIGHT:25px;
ACKGROUND-COLOR: #eeeeee;
layer-background-color: #eeeeee;
margin-top:5px;
}
#scrollContent {
MARGIN-LEFT: 4px;
POSITION: absolute;
left: 3px;
top: 125px;
}
#content {
FONT-SIZE: 14px;
Z-INDEX: 1;
LEFT: 260px;
MARGIN-LEFT: 5px;
WIDTH: 490px;
COLOR: #000000;
MARGIN-RIGHT: 5px;
FONT-FAMILY: Arial, Helvetica, sans-serif;
POSITION: absolute;
TOP: 166px;
TEXT-DECORATION: none
}
</style>
<SCRIPT type=text/javascript>
<!--
var pos = 0;
var step = -1;
var tid;
function scrollContent () {
if (document.getElementById) {
var c = document.getElementById('scrollBox');
var s = document.getElementById('scrollContent');
pos += step;
s.style.top = pos + 'px';
if (pos < -s.offsetHeight)
pos = c.offsetHeight;
} else if (document.all) {
var c = document.all['scrollBox'];
var s = document.all['scrollContent'];
pos += step;
s.style.top = pos + 'px';
if (pos < -s.offsetHeight)
pos = c.offsetHeight;
} else if (document.layers) {
var c = document.scrollBox;
var s = c.document.scrollContent;
s.top += step;
}
}
function init () {
tid = setInterval('scrollContent()', 100);
}
//-->
</SCRIPT>
</head>
<body vLink=#666666 aLink=#3366cc link=#3366cc bgColor=#ffffff leftMargin=0 topMargin=0 onLoad="init();" rightMargin=0 marginwidth="0" marginheight="0" >
<br />
<table width="900" height="200" border="0" align="center" cellpadding="0" cellspacing="0" style="margin-top:100px; ">
<tr> <%set rs=server.createobject("adodb.recordset")
sql="select top 10 bianhao,fl from news order by bianhao desc"
rs.open sql,conn,1,3
do while not rs.eof
zongshu=zongshu+rs("bianhao")
rs.movenext
loop
rs.MoveFirst
do while not rs.eof%>
<td width="80" height="212" align="center" valign="bottom"><%=rs("bianhao")%>
<div style="height:<%=rs("bianhao")/zongshu*1000%>px; background:url(gg.jpg) repeat-x bottom; width:30px; margin:5px auto; overflow: hidden"></div>
<%=rs("title")%></td>
<%rs.movenext
loop
rs.close
set rs=nothing%>
</tr>
</table>
<!---->
<div style="position:absolute; left:50px; top:5px; font-size:14px; color:red; font-weight:bold">今日到账</div>
<DIV id=scrollBox >
<DIV id=scrollContent >
<%set rs=server.createobject("adodb.recordset")
sql="select * from news order by bianhao desc"
rs.open sql,conn,1,3
do while not rs.eof%>
<table width="250" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="left"><%=rs("title")%></td>
<td align="right"><%=rs("bianhao")%></td>
</tr>
</table>
<%rs.movenext
loop
rs.close
set rs=nothing%>
</DIV>
</DIV>
</body>
</html>
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
仅从这段代码分析,下面这段:
<%
a=0
cols=3
do while not rs1.eof
if a mod cols=0 then response.Write("<tr >")
a=a+1
%>
应该是rs4而不是rs1
还有,在rs4的循环中频繁打开关闭数据库,显得效率很低.你可以把rs4的sql语句贴出来,我想应该有更好解决的办法.
把if not rs5.eof then和end if去了,这两句在这里一点用处都没有,而且会起到坏效果,试想一下,假如rs5.eof为真,if体不会执行,rs5.close也不会执行,这时你的rs5就无法释放了.还有rs4.close 后面也有一个end if,不知这与哪个if对应.
<%
a=0
cols=3
do while not rs1.eof
if a mod cols=0 then response.Write("<tr >")
a=a+1
%>
应该是rs4而不是rs1
还有,在rs4的循环中频繁打开关闭数据库,显得效率很低.你可以把rs4的sql语句贴出来,我想应该有更好解决的办法.
把if not rs5.eof then和end if去了,这两句在这里一点用处都没有,而且会起到坏效果,试想一下,假如rs5.eof为真,if体不会执行,rs5.close也不会执行,这时你的rs5就无法释放了.还有rs4.close 后面也有一个end if,不知这与哪个if对应.
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
问题表述不太清楚,HI me
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |