下面是我一段asp代码,主要功能是将产品从数据库中调出显示在网页.可问题是代码实现的是一个产品
显示在一行上,我想将三个产品显示在同一行上,到第四个再另起一行显示,不知道如何修改.请各位高手帮忙看看,不胜感激
<%
If Request.Form("cndok")="Go" Then Response.Redirect "Product.asp?page="&Trim(Request.Form("pp"))
Set rs=Server.CreateObject("Adodb.RecordSet")
Sql = "Select * From [Product] Where [Pass]=true Order By [UpTime] Desc"
rs.Open Sql,Conn,1,1dim MaxPerPage
MaxPerPage=3
Dim text,checkpage
text="0123456789"
Rs.PageSize=MaxPerPage
for i=1 to len(request("page"))
checkpage=instr(1,text,mid(request("page"),i,1))
if checkpage=0 then
exit for
end if
nextIf checkpage<>0 then
If NOT IsEmpty(request("page")) Then
CurrentPage=Cint(request("page"))
If CurrentPage < 1 Then CurrentPage = 1
If CurrentPage > Rs.PageCount Then CurrentPage = Rs.PageCount
Else
CurrentPage= 1
End If
If not Rs.eof Then Rs.AbsolutePage = CurrentPage end if
Else
CurrentPage=1
End if
Function ShowProa()
Dim showH
If rs.Eof Then
showH = showH & "没有产品!"
Else
i=0
j=0
Do While Not rs.Eof
con=rs("Content")
mm=rs("Mome")
If Len(con)>30 Then con=Left(con,30) & "..."
If Len(mm)>30 Then mm=Left(mm,30) & "..."
showH = showH & "<table width=100% border=0 align=center cellpadding=5 cellspacing=1 bgcolor=#d8d8d8>"
showH = showH & "<tr><td width=25% bgcolor=#FFFFFF> <div align=left>"
showH = showH & "<a href=ShowProduct.asp?id="&rs("ID")&"><img src=admin/"&rs("Image")&" border=0 width=100 height=80></a></div><br>"
showH = showH & " 产品名称:<a href=ShowProduct.asp?id="&rs("ID")&">"&rs("Name")&"</a><br>"
showH = showH & "<div align=left><a href=javascript:shop("&rs("Product_ID")&");><img src=JaOne/Buy.gif border=0></a></div></td>"
showH = showH & "</tr></table>"
i=i+1
If i >= MaxPerpage Then Exit do
rs.MoveNext
Loop
End if
ShowProa=showH
End Function
显示在一行上,我想将三个产品显示在同一行上,到第四个再另起一行显示,不知道如何修改.请各位高手帮忙看看,不胜感激
<%
If Request.Form("cndok")="Go" Then Response.Redirect "Product.asp?page="&Trim(Request.Form("pp"))
Set rs=Server.CreateObject("Adodb.RecordSet")
Sql = "Select * From [Product] Where [Pass]=true Order By [UpTime] Desc"
rs.Open Sql,Conn,1,1dim MaxPerPage
MaxPerPage=3
Dim text,checkpage
text="0123456789"
Rs.PageSize=MaxPerPage
for i=1 to len(request("page"))
checkpage=instr(1,text,mid(request("page"),i,1))
if checkpage=0 then
exit for
end if
nextIf checkpage<>0 then
If NOT IsEmpty(request("page")) Then
CurrentPage=Cint(request("page"))
If CurrentPage < 1 Then CurrentPage = 1
If CurrentPage > Rs.PageCount Then CurrentPage = Rs.PageCount
Else
CurrentPage= 1
End If
If not Rs.eof Then Rs.AbsolutePage = CurrentPage end if
Else
CurrentPage=1
End if
Function ShowProa()
Dim showH
If rs.Eof Then
showH = showH & "没有产品!"
Else
i=0
j=0
Do While Not rs.Eof
con=rs("Content")
mm=rs("Mome")
If Len(con)>30 Then con=Left(con,30) & "..."
If Len(mm)>30 Then mm=Left(mm,30) & "..."
showH = showH & "<table width=100% border=0 align=center cellpadding=5 cellspacing=1 bgcolor=#d8d8d8>"
showH = showH & "<tr><td width=25% bgcolor=#FFFFFF> <div align=left>"
showH = showH & "<a href=ShowProduct.asp?id="&rs("ID")&"><img src=admin/"&rs("Image")&" border=0 width=100 height=80></a></div><br>"
showH = showH & " 产品名称:<a href=ShowProduct.asp?id="&rs("ID")&">"&rs("Name")&"</a><br>"
showH = showH & "<div align=left><a href=javascript:shop("&rs("Product_ID")&");><img src=JaOne/Buy.gif border=0></a></div></td>"
showH = showH & "</tr></table>"
i=i+1
If i >= MaxPerpage Then Exit do
rs.MoveNext
Loop
End if
ShowProa=showH
End Function
解决方案 »
- 请教高手,类似百度文库中预览word内容功能
- Winform和Web项目调用WCF时响应时间问题
- 高手帮帮忙..flash的问题...急..
- SmartGridView如何分页?
- ASP.NET 购物车 谁能帮我做个最简单的购物车呢?
- 如何在后台获取当前页面的http地址?
- 高手帮我看看这段代码,有关insert和update的,不知道我错在哪了,就是插入和修改不了
- 关于datalist一个简单问题,不知道该怎么弄了~
- 求助关于DATAGRID的列隐藏问题!
- 在ASP.NET中怎样实现将client上的电子表格数据送到server上的sql server数据库里
- 想通过点击LinkButton服务器控件在服务器上的当前目录下创建一个子目录怎么做?
- 求一个查询语句
http://chs.gotdotnet.com/quickstart/aspplus/samples/webforms/ctrlref/webctrl/datalist/doc_datalist.aspx
---
在循环里面弄个计数器i
if i mod 3 = 0
<tr>
</tr>
else
<td>
</td>
http://ms.mblogger.cn/net_lover/posts/8089.aspx
1.jj,nLeft,cCol 三个变量定义的是什么?
2.Response.Write 后面的语句具体我要怎么实现
谢谢