if Rs.eof or Rs.bof then
response.Write"<td width=149 align=right>暂时没有相关信息...</td>"
else
i=1
do while not Rs.eof
i=i+1
image=Rs("imageurl")
%>
<td height="100">
<table width="90%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td align="center"><A href="<%=image%>" target="_blank"><img src="<%=image%>" width="80" height="80" border="0"></a></td>
</tr>
</table></td>
<%
if i>3 then
response.write "</tr><tr align='center'>"
i=1
end if
Rs.Movenext
loop
end if
set rs=nothing
end if
%>
if Rs.eof or Rs.bof then
response.Write"<td width=149 align=right>暂时没有相关信息...</td>"
else
i=1
do while not Rs.eof
i=i+1
image=appPicPath&Rs("Pimagename")
%>
<td height="100">
<table width="90%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td align="center"><A href="<%=image%>" target="_blank"><img src="<%=image%>" width="80" height="80" border="0"></a></td>
</tr>
</table></td>
<%
if i>3 then
response.write "</tr><tr align='center'>"
i=1
end if
Rs.Movenext
loop
end if
set rs=nothing
end if
%>
sorry,错了
应该是
<%
sql="select top 9 * from info order id date desc"
rs.open sql,conn,1,1
do while not j=3
i=0
if not rs.eof then
response.write"<tr>"
do while not rs.eof
response.write"<td width=""95"" align=""center"" valign=""top"" nowrap>"
response.write"<a target=""_blank"" href="""&rs("pic")&""">"
response.write"<img src="""&rs("pic")&""" border=""0"" width=""95"" height=""75"">
response.write "</td>"
i=i+1
if i>=3 then exit do
rs.movenext
loop
response.write"</tr>"
end if
j=j+1
' response.write(j)
loop
rs.close
%>
搞定
你用你的相应变量替换下面代码的变量就可以了
效果图在http://xike.wegame.com/xg.jpg
<%
sql="select top 9 * from info order id date desc"
rs.open sql,conn,1,1
do while not j=3
i=0
if not rs.eof then
response.write"<tr>"
do while not rs.eof
response.write"<td width=""95"" align=""center"" valign=""top"" nowrap>"
response.write"<a target=""_blank"" href=""info/"&rs("id")&".htm"">"
response.write"<img alt="""&rs("title")&" "&rs("se")&""" src="""&rs("pic")&""" border=""0"" width=""95"" height=""75"">"
response.write "</td>"
i=i+1
if i>=3 then exit do
rs.movenext
loop
response.write"</tr>"
end if
j=j+1
' response.write(j)
loop
rs.close
%>
第二个文件
pic.asp
'读你的图片的地址
'只有读取数据库部分
<%
i=0
sql="select top 9 * from info where pic<>'' order by id desc" '取出前9张图片
rs.open sql,conn,1,1
'你用for循环3次下面的代码就是3行3列的了
if not rs.eof then
do while not rs.eof
response.write"<td width=""95"" align=""center"" valign=""top"" nowrap>"
response.write"<a target=""_blank"" href="""&rs("pic")&""">"
response.write"<img src="""&rs("pic")&""" border=""0"" width=""95"" height=""75"">
response.write"</td>"
i=i+1
if i>=3 then exit do
rs.movenext
loop
end if
rs.close
%>
搞不定再说
<td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<th align="right" scope="col"><img src="images/wsdg-1.gif" width="593" height="150"></th>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<th height="2" bgcolor="#9B9B00" scope="col"></th>
</tr>
</table>
<table width="100%" border="0">
<%
dim i,intPage,page,pre,last,filepath,IsShow
set rs=server.createobject("adodb.recordset")
if request("newnames")<>"" then
sql = "select * from com_info where name like '%"&request("newnames")&"%' order by ID desc"
else
sql="select * from com_info "&searchStr&merchandise_mc&"order by ID desc"
end if
rs.open sql,conn,1,3
rs.PageSize = 9 '这里设定每页显示的记录数
pre = true
last = true
page = trim(Request.QueryString("page"))
if len(page) = 0 then
intpage = 1
pre = false
else
if cint(page) =< 1 then
intpage = 1
pre = false
else
if cint(page) >= rs.PageCount then
intpage = rs.PageCount
last = false
else
intpage = cint(page)
end if
end if
end if
if not rs.eof then
rs.AbsolutePage = intpage
end if
for i=1 to rs.PageSize
if rs.EOF or rs.BOF then exit for
if (counts mod 3) =0 then
%>
<tr>
<%
end if
counts=counts+1
%>
<td>
<table width="100%" border="0">
<tr>
<td width="33%">
<div align="center" class="style2">
<div align="center"><img src="images/point.gif" width="10" height="10"><strong><%=rs("merchandise_pp")%></strong><br>
<%=rs("name")%>
</div>
</div></td>
</tr>
<tr>
<td width="33%">
<div align="center"><a href="wsdg_view.asp?ID=<%=rs("ID")%>"><img src="./<%=rs("merchandise_tplj")%>" width="150" height="150" border="0"></a>
</div></td></tr>
<tr>
<td width="33%">
<div align="center" class="style2">价格:<%=rs("merchandise_xj")%>元
<%
if rs("merchandise_yj")<>"" then
%>
<span class="d9yellow" >(原价:
<%=rs("merchandise_yj")%>元
)
<%
end if
%>
</span> </div></td>
</tr>
</table>
<%
rs.movenext
next
%>
</table>
<table width="99%" border="1" cellpadding="2" cellspacing="2" borderColorLight=#808080 borderColorDark=#ffffff>
<tr>
<%if rs.pagecount > 0 then%>
<td width="13%" align="left"><span class="style2">当前页<%=intpage%>/<%=rs.PageCount%></span></td>
<%else%>
<td width="41%" align="left"><span class="style2">当前页0/0</span></td>
<%end if%>
<td width="46%" align="right"> <span class="style2"><a href="wsdg.asp?merchandise_flid=<%=merchandise_flid%>&names=<%=names%>&page=1">首页</a>|
<%if pre then%>
<a href="wsdg.asp?merchandise_flid=<%=merchandise_flid%>&names=<%=names%>&page=<%=intpage -1%>">上页</a>|
<%end if%>
<%if last then%>
<a href="wsdg.asp?merchandise_flid=<%=merchandise_flid%>&names=<%=names%>&page=<%=intpage +1%>">下页</a> |
<%end if%>
<a href="wsdg.asp?merchandise_flid=<%=merchandise_flid%>&names=<%=names%>&page=<%=rs.PageCount%>">尾页</a>|转到第
<select name="sel_page" onchange="javascript:location=this.options[this.selectedIndex].value;">
<%
for i = 1 to rs.PageCount
if i = intpage then%>
<option value="wsdg.asp?merchandise_flid=<%=merchandise_flid%>&names=<%=names%>&page=<%=i%>" selected><%=i%></option>
<%else%>
<option value="wsdg.asp?merchandise_flid=<%=merchandise_flid%>&names=<%=names%>&page=<%=i%>"><%=i%></option>
<%
end if
next
%>
</select>
页</font>
</span></td>
</tr>
</table>
</td>