首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > ASP >

asp一行只能显示一个产品,小弟我想一行显示八个产品

2012-03-28 
asp一行只能显示一个产品,我想一行显示八个产品bodybgcolor #9f273c tablewidth 100% height 5

asp一行只能显示一个产品,我想一行显示八个产品
<body     bgcolor= "#9f273c ">
<table   width= "100% "   height= "534 "     border= "0 "   cellpadding= "0 "   cellspacing= "0 "   background= "image/leatherbg.jpg "   bgcolor= "#FCF7F4 ">
    <tr>
        <td   width= "52% "   height= "534 "   align= "center "   valign= "top "> <table   width= "86% "   height= "509 "     border= "0 "   cellpadding= "0 "   cellspacing= "0 ">
            <tr>
                <td   height= "412 "   align= "center "   valign= "top ">
<TABLE   WIDTH= "635 "   height= "393 "   BORDER= "0 "   ALIGN= "CENTER "   CELLPADDING= "0 "   CELLSPACING= "0 "   >
<TR>
    <TD   HEIGHT= "89 "   align= "left "   VALIGN= "bottom "> <strong>   Your   direction   :   <a   href= "../ "> First Page   </a> -&gt;   <a   href= "../product.htm "> Product   </a> </strong> </TD>
</TR>
<TR> <TD   width= "654 "   HEIGHT= "304 "   align= "left "   VALIGN= "top ">
            <!--#include   file= "conn.asp "-->
<!--#include   file= "config.asp "-->
    <%dim   action
    action=SafeRequest( "action ",1)
Const   MaxPerPage=8
      dim   totalPut      
      dim   CurrentPage
      dim   TotalPages
      dim   j
      dim   sql
        if   Not   isempty(SafeRequest( "page ",1))   then
            currentPage=Cint(SafeRequest( "page ",1))
      else
            currentPage=1
      end   if  
  set   rs=server.CreateObject( "adodb.recordset ")
    select   case   action
    case   " "
    rs.open   "select   id,prename,name,company,mark,intro,introduce,predate,productdate,pretype,type,viewnum,price,price1,price2,other,grade,discount,pic,stock,amount   from   product   where   discount <=1   and   stock   > =   1   order   by   id   asc ",conn,1,1
    case   "12 "
    rs.open   "select   id,prename,name,company,mark,intro,introduce,predate,productdate,pretype,type,viewnum,price,price1,price2,other,grade,discount,pic,stock,amount   from   product   where   discount <=0.20   and   stock   > =   1   order   by   id   asc ",conn,1,1
    case   "34 "
    rs.open   "select   id,prename,name,company,mark,intro,introduce,predate,productdate,pretype,type,viewnum,price,price1,price2,other,grade,discount,pic,stock,amount   from   product   where   discount <=0.40   and   discount> 0.2   and   stock   > =   1   order   by   id   asc ",conn,1,1


    case   "56 "
    rs.open   "select   id,prename,name,company,mark,intro,introduce,predate,productdate,pretype,type,viewnum,price,price1,price2,other,grade,discount,pic,stock,amount   from   product   where   discount <=0.60   and   discount> 0.4   and   stock   > =   1   order   by   id   asc ",conn,1,1
    case   "78 "
    rs.open   "select   id,prename,name,company,mark,intro,introduce,predate,productdate,pretype,type,viewnum,price,price1,price2,other,grade,discount,pic,stock,amount   from   product   where   discount <=0.80   and   discount> 0.6   and   stock   > =   1   order   by   id   asc ",conn,1,1
                                          case   "9 "
    rs.open   "select   id,prename,name,company,mark,intro,introduce,predate,productdate,pretype,type,viewnum,price,price1,price2,other,grade,discount,pic,stock,amount   from   product   where   discount <1   and   discount> 0.80   and   stock   > =   1   order   by   id   asc ",conn,1,1
    end   select
   
if   err.number <> 0   then
response.write   " "
end   if

    if   rs.eof   And   rs.bof   then
              Response.Write   " <p   align= 'center '>   对不起,目前还没有这种商品! </p> "
      else
    totalPut=rs.recordcount

            if   currentpage <1   then
                    currentpage=1
            end   if

            if   (currentpage-1)*MaxPerPage> totalput   then
      if   (totalPut   mod   MaxPerPage)=0   then
          currentpage=   totalPut   \   MaxPerPage
      else
            currentpage=   totalPut   \   MaxPerPage   +   1
      end   if
            end   if

              if   currentPage=1   then
                        showContent
                        showpage   totalput,MaxPerPage, "discount.asp "
              else
                    if   (currentPage-1)*MaxPerPage <totalPut   then
                        rs.move     (currentPage-1)*MaxPerPage
                        dim   bookmark
                        bookmark=rs.bookmark
                        showContent


                          showpage   totalput,MaxPerPage, "discount.asp "
                else
                currentPage=1
                      showContent
                      showpage   totalput,MaxPerPage, "discount.asp "
            end   if
      end   if
            end   if

      sub   showContent
              dim   i
      i=0

%>
            <%do   while   not   rs.eof%>
            <br>
            <br>
            <TABLE   WIDTH= "72% "   BORDER= "0 "   ALIGN= "center "   CELLPADDING= "0 "   CELLSPACING= "0 ">
<TR>  
                    <TD   WIDTH= "42% "   ROWSPAN= "7 "   align= "center ">
    <TABLE   WIDTH= "199 "   HEIGHT= "105 "   BORDER= "0 "   CELLPADDING= "0 "   CELLSPACING= "0 ">
                            <TR>  
                                <TD   width= "201 "   height= "105 "   colspan= "2 "   align= "center "   valign= "middle "   >
<a   href=../ <%   =   trim(rs( "pic "))%>   target= "_blank ">
  <%   if   trim(rs( "pic ")) <> " "   then   %>
<img   src=../ <%   =   trim(rs( "pic "))%>     border=0   width= "140 "   height= "100 "   style= "border:   1px   solid   #C0C0C0 "> </A>
<%     else   %> </A>
<%   end   if   %> </TD>
                            </TR>
                        </TABLE> </TD>
                 
               
                                <TR>  
                   
                    <TD   width= "58% "   align= "left "> <p> Product   Name   :   <font   color= "#FF6600 "> <%=trim(rs( "name "))%> </font> </p>
                        <p> Kind: <%=trim(rs( "viewnum "))%> </p>


<p> <a   href= "check.asp?ProdId= <%   =   rs( "id ")   %> "   target= "_blank "> <img   src=images/skin/default/addto.gif   align=absmiddle   border=0> </a> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                    <%   if   alipay   =1   then   %>
                                    <a   href= "alicheck.asp?ProdId= <%   =   rs( "id ")   %> "   target= "_blank "> </a>                                     <%   Else   %>
                            &nbsp;
                                    <%   end   if   %>
                        </p> </TD>
                   
                   
                </TR>
            </TABLE>
            <table   width= "62% "   align= "center ">
                <TR>
                    <TD   height= "15 "   class=table-xia> &nbsp; </TD>
                </TR> </table>
            <%i=i+1
if   i> =MaxPerPage   then   Exit   Do
rs.movenext
loop
rs.close
set   rs=nothing%>
            <%    
End   Sub      
   
Function   showpage(totalnumber,maxperpage,filename)    
    Dim   n
   
If   totalnumber   Mod   maxperpage=0   Then    
n=   totalnumber   \   maxperpage    
Else
n=   totalnumber   \   maxperpage+1    
End   If   %>
<form   method=Post   action= <%=filename%> >
<p   align= "center ">
<%
If   CurrentPage <2   Then     %>
首页   上一页
<%   Else     %>
<a   href= <%   =   filename   %> ?page=1> 首   页 </a>
<a   href= <%   =   filename   %> ?page= <%   =   CurrentPage-1   %> > 上一页 </a>  

<%   End   If  
If   n-currentpage <1   Then     %>
下一页   末   页
<%     Else     %>
<a   href= <%   =   filename   %> ?page= <%   =   (CurrentPage+1)   %> > 下一页 </a>  


<a   href= <%   =   filename   %> ?page= <%   =   n   %> > 末   页 </a>
<%   End   If     %>
  第   <b> <%   =   CurrentPage   %> </b>   页   共   <b> <%   =   n   %> </b>   页
共 <b> <%   =   totalnumber   %> </b> 件商品 
GO第:
<input   type= 'text '   name= 'page '   size=2   maxlength=10   class=smallInput   value= <%   =   currentpage   %> >
页 <input   type= 'submit '     class= 'contents '   value= 'Go '   name= 'cndok '>
</form>
<%
End   Function    
%>
        </TD>
    </TR>
</TABLE> </td>
            </tr>
        </table> </td>
    </tr>
</table>
</body>


我现在这个程序一行只能显示一个产品,我想一行显示八个产品,请问怎么改?

大虾怎么改?

[解决办法]
我底下的这段代码是一行4个,一页12个,你可以参考下,这样写。


<table width= "90% " height= "150 " border= "0 " align= "center " cellpadding= "0 " cellspacing= "0 ">
<%
dim i
for i=1 to 12 step 4
%>
<tr>
<td width= "150 " height= "150 " align= "center "> <table width= "125 " height= "150 " border= "0 " cellpadding= "0 " cellspacing= "0 " bordercolor= "#666666 ">
<tr align= "center " valign= "middle ">
<td width= "121 " align= "left " valign= "middle "> <div align= "left ">
<p align= "left "> <a href= " <%=rs.fields( "tpdz ")%> "> <img src= " <%=rs.fields( "tpdz ")%> " width= "120 " height= "120 " border= "0 "> </a>
<font color= "#FFFFFF "> <strong> 编号: <a href= " <%=rs.fields( "tpdz ")%> "> <%=rs.fields( "tpbh ")%> <br>
</a> 规格: <%=rs.fields( "tpgg ")%> <br>
价格: <%=rs.fields( "ckjg ")%> </strong> </font> </p>
</div> </td>
</tr>
</table> </td>
<%
rs.movenext
if rs.eof then exit for
%>
<td width= "150 " height= "150 " align= "center "> <table width= "120 " height= "150 " border= "0 " cellpadding= "0 " cellspacing= "0 " bordercolor= "#996666 ">
<tr align= "center " valign= "middle ">
<td width= "123 " align= "left " valign= "middle "> <div align= "left ">
<p align= "left "> <a href= " <%=rs.fields( "tpdz ")%> ">
<img src= " <%=rs.fields( "tpdz ")%> " width= "120 " height= "120 " border= "0 "> </a>


<font color= "#FFFFFF "> <strong> 编号: <a href= " <%=rs.fields( "tpdz ")%> "> <%=rs.fields( "tpbh ")%> <br>
</a> 规格: <%=rs.fields( "tpgg ")%> <br>
价格: <%=rs.fields( "ckjg ")%> </strong> </font> </p>
</div> </td>
</tr>
</table> </td>
<%
rs.movenext
if rs.eof then exit for
%>
<td width= "150 " height= "150 " align= "center "> <table width= "125 " height= "150 " border= "0 " cellpadding= "0 " cellspacing= "0 " bordercolor= "#996666 ">
<tr align= "center " valign= "middle ">
<td width= "121 " align= "left " valign= "middle "> <div align= "left ">
<p align= "left "> <a href= " <%=rs.fields( "tpdz ")%> ">
<img src= " <%=rs.fields( "tpdz ")%> " width= "120 " height= "120 " border= "0 "> </a>
<font color= "#FFFFFF "> <strong> 编号: <a href= " <%=rs.fields( "tpdz ")%> "> <%=rs.fields( "tpbh ")%> <br>
</a> 规格: <%=rs.fields( "tpgg ")%> <br>
价格: <%=rs.fields( "ckjg ")%> </strong> </font> </p>
</div> </td>
</tr>
</table>
<%
rs.movenext
if rs.eof then exit for
%>
<td width= "150 " height= "150 " align= "center "> <table width= "125 " height= "179 " border= "0 " cellpadding= "0 " cellspacing= "0 " bordercolor= "#996666 ">
<tr align= "center " valign= "middle ">
<td width= "121 " height= "177 " align= "left " valign= "middle "> <div align= "left ">
<p align= "left "> <a href= " <%=rs.fields( "tpdz ")%> ">
<img src= " <%=rs.fields( "tpdz ")%> " width= "120 " height= "120 " border= "0 "> </a>
<font color= "#FFFFFF "> <strong> 编号: <a href= " <%=rs.fields( "tpdz ")%> "> <%=rs.fields( "tpbh ")%> <br>
</a> 规格: <%=rs.fields( "tpgg ")%> <br>
价格: <%=rs.fields( "ckjg ")%> </strong> </font> </p>
</div> </td>
</tr>
</table> </tr>
<%
rs.movenext
if rs.eof then exit for
next
%>
</table>

热点排行
Bad Request.