ASP第行显示4张图片,共显示20张,向上要滚动
<tablewidth="100%"border="0"cellspacing="0"cellpadding="0"><trvalign="top"><tdwidth="...
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr valign="top">
<td width="98%">
<table width="99%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="216"><img src="images/products.gif" width="216" height="23"></td>
<td background="images/titlebg.gif"> </td>
<td width="38"><a href="class.asp"><img src="images/more.gif" width="38" height="23" border="0"></a></td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="8"></td>
</tr>
</table>
<div id=demo style=overflow:hidden;height:160;width:790;>
<table width="790" border="0" cellspacing="0" cellpadding="0">
<tr>
<td id=demo1 valign=top><table width="790" border="0" cellspacing="4" cellpadding="2">
<tr>
<%
set rs=server.createobject("adodb.recordset")
sql="select Top 20 * from products where bestbook=1 order by bookid desc"
rs.open sql,conn,1,1
if not rs.eof then
while not rs.eof
%>
<td><table width="164" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="127" align="center" valign="middle" background="images/probg.gif"><%
if trim(rs("bookpic"))="" then
response.write"暂时无图"
else
response.write"<img border='0' src='"&trim(rs("bookpic"))&"' width='158' height='118'>"
end if
%> </td>
</tr>
<tr>
<td height="29" align="center" background="images/probgtitle.gif"><a href='products.asp?bookid=<%=rs("bookid")%>'><font color=#ff0000><%=left(trim(rs("bookname")),10)%></font></a> </td>
</tr>
</table></td>
<%
rs.movenext
wend
end if
rs close
set rs=nothing
%>
</tr>
</table></td>
<td id=demo2 valign=top> </td>
</tr>
</table>
</div>
<script>
var speed=30
demo2.innerHTML=demo1.innerHTML
function Marquee(){
if(demo2.offsetWidth-demo.scrollLeft<=0)
demo.scrollLeft-=demo1.offsetWidth
else{
demo.scrollLeft++
}
}
var MyMar=setInterval(Marquee,speed)
demo.onmouseover=function() {clearInterval(MyMar)}
demo.onmouseout=function() {MyMar=setInterval(Marquee,speed)}
</script></td>
</tr>
</table>
请讲详细一下 展开
<tr valign="top">
<td width="98%">
<table width="99%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="216"><img src="images/products.gif" width="216" height="23"></td>
<td background="images/titlebg.gif"> </td>
<td width="38"><a href="class.asp"><img src="images/more.gif" width="38" height="23" border="0"></a></td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="8"></td>
</tr>
</table>
<div id=demo style=overflow:hidden;height:160;width:790;>
<table width="790" border="0" cellspacing="0" cellpadding="0">
<tr>
<td id=demo1 valign=top><table width="790" border="0" cellspacing="4" cellpadding="2">
<tr>
<%
set rs=server.createobject("adodb.recordset")
sql="select Top 20 * from products where bestbook=1 order by bookid desc"
rs.open sql,conn,1,1
if not rs.eof then
while not rs.eof
%>
<td><table width="164" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="127" align="center" valign="middle" background="images/probg.gif"><%
if trim(rs("bookpic"))="" then
response.write"暂时无图"
else
response.write"<img border='0' src='"&trim(rs("bookpic"))&"' width='158' height='118'>"
end if
%> </td>
</tr>
<tr>
<td height="29" align="center" background="images/probgtitle.gif"><a href='products.asp?bookid=<%=rs("bookid")%>'><font color=#ff0000><%=left(trim(rs("bookname")),10)%></font></a> </td>
</tr>
</table></td>
<%
rs.movenext
wend
end if
rs close
set rs=nothing
%>
</tr>
</table></td>
<td id=demo2 valign=top> </td>
</tr>
</table>
</div>
<script>
var speed=30
demo2.innerHTML=demo1.innerHTML
function Marquee(){
if(demo2.offsetWidth-demo.scrollLeft<=0)
demo.scrollLeft-=demo1.offsetWidth
else{
demo.scrollLeft++
}
}
var MyMar=setInterval(Marquee,speed)
demo.onmouseover=function() {clearInterval(MyMar)}
demo.onmouseout=function() {MyMar=setInterval(Marquee,speed)}
</script></td>
</tr>
</table>
请讲详细一下 展开
3个回答
展开全部
<body>
<div align="center">
<table width="790" border="0" cellpadding="0" cellspacing="0" bordercolor="#FFFFFF" bgcolor="#FFFFFF">
<tr>
<td width="7" height="423" bgcolor="#ededed"> </td>
<td width="776" align="center" valign="top">
<% call showheader() %>
<table height=246 cellspacing=0 cellpadding=0 width=774 border=0>
<tbody>
<tr>
<td height=4 colspan="2" bgcolor=#ff9038></td>
</tr>
<tr valign=center align=left bgcolor=#e1e0e0>
<td width="522" height=20 bgcolor=#ededed> <img src="imges/zhshi.png" width="16" height="16"> <span class="style4">欢迎访问</span></td>
</tr>
<tr>
<td height="15" colspan="2" background="imges/line2.gif" class="style1"><div align="left"> 您现在的位置:活动照片</div></td>
</tr>
<tr valign=top align=center>
<td height="75" colspan="2">
<%
dim rs,sql6
set rs=server.CreateObject("adodb.recordset")
sql6="select * from xhphotos where leixing='1' order by riqi desc"
rs.open sql6,conn,1
if rs.bof or rs.eof then
response.write"<div align='center'><img src='imges/nophoto.gif'></div>"
else
dim page
page=Clng(request("page"))
rs.pagesize=20
if page<1 then page=1
if page>rs.pagecount then page=rs.pagecount
rs.Absolutepage=page
%>
<table width="100%">
<tr>
<%
for i=1 to rs.pagesize
%>
<%
if rs.eof then exit for
%>
<td width="25%">
<table width="148" height="196">
<tr>
<td valign="middle" background="imges/pic_bg.gif">
<div align="center">
<a href="count_pho.asp?phoid=<%=rs("phoid")%>"><img src="xhphotos/<%=rs("photo")%>" height="180" width="120"border="0"></a>
</div>
</td>
</tr>
</table>
</td>
<%
if i mod 4 = 0 then response.write "</tr>"
rs.movenext
next
if i-1 mod 4 <> 0 then
for j=1 to 4-cint(i-1 mod 4)
response.write "<td width=""25%""> </td>"
next
response.write "</tr>"
end if
%>
</table>
<%
end if
%>
<table border="0" width="774">
<tr>
<td>
<div align="center">
<form name="form1" method="get" action="phohuodong.asp">
<%
Response.write "<span class='style1'>共找到</span>" & "<span class='style1'><font color='#FF0000'>" & Cstr(rs.RecordCount) & "</font></span>" & "<span class='style1'>张照片</span> "
if page<>1 then
response.write "<span class='style1'><a href=?page=1>首页</a> </span>"
response.write "<span class='style1'><a href=?page="&(page-1)&">上一页</a></span> "
end if
if page<>rs.pagecount then
response.write "<span class='style1'><a href=?page="&(page+1)&">下一页</a> </span>"
response.write "<span class='style1'><a href=?page="&rs.pagecount&">尾页</a> </span>"
end if
%>
<span class='style1'>第<font color='#FF0000'><%=page%></font>页/共<font color='#FF0000'><%=rs.pagecount%></font>页 </span>
<input name="page" size="1" value="<%=page%>">
<INPUT id=image type=image src="imges/go.gif" border=0>
</form>
</div></td>
</tr>
</table>
</td>
</tr>
</tbody>
</table>
<div align="center">
<% call showfooter() %>
</div></td>
<td width="7" bgcolor="#ededed"> </td>
</tr>
</table>
</div>
</body>
回答补充,你直接把我这段代码贴上去就行了,具体讲来,就是使用FOR语句来控制每行显示数量,用分页代码控制每页的显示数量,并把不能填满一页的图片位置用空格补上,以防不能正确显示表格
<div align="center">
<table width="790" border="0" cellpadding="0" cellspacing="0" bordercolor="#FFFFFF" bgcolor="#FFFFFF">
<tr>
<td width="7" height="423" bgcolor="#ededed"> </td>
<td width="776" align="center" valign="top">
<% call showheader() %>
<table height=246 cellspacing=0 cellpadding=0 width=774 border=0>
<tbody>
<tr>
<td height=4 colspan="2" bgcolor=#ff9038></td>
</tr>
<tr valign=center align=left bgcolor=#e1e0e0>
<td width="522" height=20 bgcolor=#ededed> <img src="imges/zhshi.png" width="16" height="16"> <span class="style4">欢迎访问</span></td>
</tr>
<tr>
<td height="15" colspan="2" background="imges/line2.gif" class="style1"><div align="left"> 您现在的位置:活动照片</div></td>
</tr>
<tr valign=top align=center>
<td height="75" colspan="2">
<%
dim rs,sql6
set rs=server.CreateObject("adodb.recordset")
sql6="select * from xhphotos where leixing='1' order by riqi desc"
rs.open sql6,conn,1
if rs.bof or rs.eof then
response.write"<div align='center'><img src='imges/nophoto.gif'></div>"
else
dim page
page=Clng(request("page"))
rs.pagesize=20
if page<1 then page=1
if page>rs.pagecount then page=rs.pagecount
rs.Absolutepage=page
%>
<table width="100%">
<tr>
<%
for i=1 to rs.pagesize
%>
<%
if rs.eof then exit for
%>
<td width="25%">
<table width="148" height="196">
<tr>
<td valign="middle" background="imges/pic_bg.gif">
<div align="center">
<a href="count_pho.asp?phoid=<%=rs("phoid")%>"><img src="xhphotos/<%=rs("photo")%>" height="180" width="120"border="0"></a>
</div>
</td>
</tr>
</table>
</td>
<%
if i mod 4 = 0 then response.write "</tr>"
rs.movenext
next
if i-1 mod 4 <> 0 then
for j=1 to 4-cint(i-1 mod 4)
response.write "<td width=""25%""> </td>"
next
response.write "</tr>"
end if
%>
</table>
<%
end if
%>
<table border="0" width="774">
<tr>
<td>
<div align="center">
<form name="form1" method="get" action="phohuodong.asp">
<%
Response.write "<span class='style1'>共找到</span>" & "<span class='style1'><font color='#FF0000'>" & Cstr(rs.RecordCount) & "</font></span>" & "<span class='style1'>张照片</span> "
if page<>1 then
response.write "<span class='style1'><a href=?page=1>首页</a> </span>"
response.write "<span class='style1'><a href=?page="&(page-1)&">上一页</a></span> "
end if
if page<>rs.pagecount then
response.write "<span class='style1'><a href=?page="&(page+1)&">下一页</a> </span>"
response.write "<span class='style1'><a href=?page="&rs.pagecount&">尾页</a> </span>"
end if
%>
<span class='style1'>第<font color='#FF0000'><%=page%></font>页/共<font color='#FF0000'><%=rs.pagecount%></font>页 </span>
<input name="page" size="1" value="<%=page%>">
<INPUT id=image type=image src="imges/go.gif" border=0>
</form>
</div></td>
</tr>
</table>
</td>
</tr>
</tbody>
</table>
<div align="center">
<% call showfooter() %>
</div></td>
<td width="7" bgcolor="#ededed"> </td>
</tr>
</table>
</div>
</body>
回答补充,你直接把我这段代码贴上去就行了,具体讲来,就是使用FOR语句来控制每行显示数量,用分页代码控制每页的显示数量,并把不能填满一页的图片位置用空格补上,以防不能正确显示表格
展开全部
在你需要显示的那行写个跑马灯循环就可以了
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
sql="select Top 20 * from products where bestbook=1 order by bookid desc"
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询