日期:2014-05-17  浏览次数:20693 次

一个多行 显示的问题,并滚动的问题
我想从数据库中提出   多个图片   在页面上   两行显示   并且滚动   怎么实现比较好   谢谢大家了

------解决方案--------------------
用层 <div> ,或者用框架
------解决方案--------------------
<%
function getFileExtName(fileName)
dim pos
pos=instrrev(filename, ". ")
if pos> 0 then
getFileExtName=mid(fileName,pos+1)
else
getFileExtName= " "
end if
end function

Const New_img=10 '显示图片数目
i=1
set rs = server.createobject( "adodb.recordset ")
sql = "select top " & New_img & " id,chanpinname,pic from chanpin where tuijian=1 and pic <> ' ' order by id desc "
rs.open sql,conn,1,1
if not rs.eof then
%>
<div align= 'center ' id= 'demo ' style= 'overflow:hidden;height:300px;width:600px; '> <!--滚动区的高度和宽度-->
<table align= 'center ' cellpadding= '0 ' cellspace= '0 ' border= '0 '>
<tr>
<td id= 'demo1 ' valign= 'top '>
<table width= '100% ' cellpadding= '0 ' cellspacing= '0 ' border= '0 ' align= 'center '>
<%
do while not rs.EOF
fileExt=lcase(getFileExtName(rs( "pic ")))
if (i mod 5 =1) then response.write " <tr align=center> " '每行显示5张图片
call newscontent
if (i mod 5 =0) then
response.Write( " </tr> ")
end if
i=i+1
if i> =New_img+1 then exit do
rs.MoveNext
loop
sub newscontent
%>
<td width= "120 " align= "center ">
<table width= "100% " border= "0 " cellspacing= "0 " cellpadding= "0 ">
<tr>
<td width= "15 "> &nbsp; </td>
<td height= "90 " align= "center ">
<a href= "Cpzs/detail.asp?id= <%=rs( "id ")%> " target= "_blank " title= " <%=trim(rs( "chanpinname "))%> ">
<%if fileext= "jpg " or fileext= "bmp " or fileext= "png " or fileext= "gif " then%>
<img border= "0 " src= "/pictures/chanpin/ <%=trim(rs( "pic "))%> " width= "120 " height= "100 " style= "border:1px solid #666666 " />
<%elseif fileext= "swf " then%>
<object classid= 'clsid:D27CDB6E-AE6D-11cf-96B8-444553540000 ' codebase= 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0 ' width= '120 ' height= '100 '>
<param name=movie value= '/pictures/chanpin/ <%=rs( "pic ")%> '>
<param name=quality value=high>
<param name= 'Play ' value= '-1 '>
<param name= 'Loop ' value= '0 '>
<param name= 'Menu ' value= '-1 '>
<param name= 'wmode ' value= 'transparent '>
<embed src= ' <%=rs( "pic ")%> ' width= '120 ' height= '100 ' pluginspage= 'http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash ' type= 'application/x-shockwave-flash '> </embed>
</object>
<%end if%>
</a> &l