[求助]怎样用asp实现产品类的自动两列排列?

[求助]怎样用asp实现产品类的自动两列排列?
http://www.ndi.com/store/webpage.cfm?WebPage_ID=15&DID=58

怎样用asp实现产品类的自动两列排列?象以上链接一样,请高手指点!
我只能实现单列自动排列。代码如下:

1<table border="1" cellspacing="1" height="266" width="396">
2<tr>
3<td height="28" width="263"> <div align="center"><font face="Arial, Helvetica, sans-serif"><strong>```
4=request("class")
5``` PRODUCTS LIST</strong></font></div></td>
6<td width="126"></td>
7</tr>   

' if rs1.bof and rs1.eof then
' response.write "no data"
' response.end
' end if
rs1.movefirst
do until rs1.eof

1<tr>
2<td height="21"> <div align="center"><a ```"="" child_class")="" href="produ.asp?class1=```
3=rs1(">```
4=rs1("child_class")
5```</a></div></td>
6<td><a ```"="" child_class")="" href="produ.asp?class1=```
7=rs1("><img ```.jpg"="" child_class")="" src="cphoto/```
8=rs1("/></a></td>
9</tr>   

rs1.movenext
loop

1<tr>
2<td height="190">
3<div align="center"></div></td>
4<td></td>
5</tr>
6</table>

---------------------------------------------------------------

1<table border="1" cellspacing="1" height="266" width="396">
2<tr>
3<td height="28" width="263"> <div align="center"><font face="Arial, Helvetica, sans-serif"><strong>```
4=request("class")
5``` PRODUCTS LIST</strong></font></div></td>
6<td width="126"></td>
7</tr>   

' if rs1.bof and rs1.eof then
' response.write "no data"
' response.end
' end if
rs1.movefirst
i=0
do until rs1.eof
if i mod 2 =0 Then Response.write "<tr>"

1<td height="21"> <div align="center"><a ```"="" child_class")="" href="produ.asp?class1=```
2=rs1(">```
3=rs1("child_class")
4```</a></div></td>
5<td><a ```"="" child_class")="" href="produ.asp?class1=```
6=rs1("><img ```.jpg"="" child_class")="" src="cphoto/```
7=rs1("/></a></td>   

if i mod 2 =1 Then Response.write "</tr>"
rs1.movenext
loop

1<tr>
2<td height="190">
3<div align="center"></div></td>
4<td></td>
5</tr>
6</table>

---------------------------------------------------------------

实例:http://eyun.52it.net/temp/shop/
主要代码:

1for i=start to over
 1<table align="left" border="0" cellpadding="0" cellspacing="0" class="text" height="90" width="260">
 2<tr>
 3<td class="text" height="70" rowspan="5" width="70"><img =rs("num")="" =timer()*100="" ```"="" ```")="" ```&num="```" alt="点击查看该商品的详细信息!" height="75" num")="" onclick='window.open("show.asp?t=```' src="pshow.asp?t=```
 4=Timer()*100
 5```&amp;amp;num=```
 6=rs(" style="cursor:hand" width="75"/></td>
 7<td height="18" width="240">商品名称:```
 8=rs("sname")
 9```</td>
10</tr>
11<tr>
12<td height="12">市场价:```
13=rs("mprice")
14```</td>
15</tr>
16<tr>
17<td height="12">会员价:```
18=rs("cprice")
19```</td>
20</tr>
21<tr>
22<td height="12">高级会员价:```
23=rs("aprice")
24```</td>
25</tr>
26<tr>
27<td height="12"><a =rs("num")="" =timer()*100="" ```")="" ```&num="```" onclick='window.open("show.asp?t=```' style="cursor:hand" title="点击查看该商品的详细信息!">[详细信息]</a> ```
28if rs("stock")&amp;lt;&amp;gt;0 then

<img =rs("num")="" =timer()*100="" ")="" &num="" align="absmiddle" alt="放入我的购物篮" onclick='window.open("buy.asp?t=' src="img/goumai.gif" style="cursor:hand"/>

1else
2```<img =rs("num")="" =timer()*100="" ```")="" ```&num="```" align="absmiddle" alt="预定该商品" onclick='window.open("yuding.asp?t=```' src="img/dinggou.gif" style="cursor:hand"/>```
3end if
4```</td>
5</tr>
6</table>
1if j mod 2=0 then
1<table border="0" cellpadding="0" cellspacing="0" class="text" width="520">
2<tr>
3<td> </td>
4</tr>
5</table>
1<table border="0" cellpadding="0" cellspacing="0" class="text" width="520">
2<tr>
3<td>   

end if
j=j+1
rs.movenext
if rs.eof then
exit for
end if
next

1</td>
2</tr>
3</table>

---------------------------------------------------------------

rs1.movefirst
i=0
do until rs1.eof
if i mod 2 =0 Then Response.write "

1<tr>"%&gt;   
2<td height="21"> <div align="center"><a ```"="" child_class")="" href="produ.asp?class1=```
3=rs1(">```
4=rs1("child_class")
5```</a></div></td>
6<td><a ```"="" child_class")="" href="produ.asp?class1=```
7=rs1("><img ```.jpg"="" child_class")="" src="cphoto/```
8=rs1("/></a></td>   

if i mod 2 =1 Then Response.write "</tr>

1"   
2rs1.movenext   
3i=i+1 '加上这句看看   
4loop 

---------------------------------------------------------------

主要代码之处在于:

1   
2col = 2 '// 初始化,此处代表分多少列   
3while not rsProduct.Eof   
4if Cols Mod 2 = 0 Then response.write "

<tr>"
col = col + 1
'//-------以下就是输入出产品各参数代码
rsProduct.MoveNext
Wend

Published At
Categories with Web编程
comments powered by Disqus