主题:  我想让表格形式显示为两列该如何改?请教高手!(附源码

jay007

职务:普通成员
等级:1
金币:0.0
发贴:21
#12004/4/1 11:59:13
<%
else
    const MaxPerPage=18
    dim totalPut
    dim CurrentPage
    dim TotalPages
    dim n
    if not isempty(request("page")) then
currentPage=cint(request("page"))
    else
currentPage=1
    end if
    nclassid=request("nclassid")
    if request("classid")<>"" then
    classid = request("classid")
    else
    classid=1 'ì???ò???1?óúclassidμ??é??~
    end if
    dim rstype2
    set

rstype2=server.createobject("adodb.recordset")
    set rstype2=conn.execute("select * from class

where classid="&cstr(classid))
    if not rstype2.eof then
        classname=rstype2("class")
    end if
    rstype2.close
    dim rstype3
    set

rstype3=server.createobject("adodb.recordset")
    set rstype3=conn.execute("select * from

nclass where nclassid="&cstr(nclassid))
    if not rstype3.eof then
    nclassname=rstype3("nclass")
    end if
    rstype3.close

%>
</div>
<table border="0" width="750" cellpadding="0"

cellspacing="0" align="center" height="400">
<tr>
<td width="200" valign="top" align="center"

bgcolor="#F299B8" background="images/linebg.gif">
<table border="0" width="199" cellspacing="0"

cellpadding="0">
<tr>
<td width="100%" height="17">
<table width="200" border="0"

cellspacing="0" cellpadding="0" align="center">
<tr>
<td height="20"><img

src="images/hot.gif" width="200" height="22">
</td>
</tr>
<tr>
<td>
<table width="92%" border="0"

cellspacing="0" cellpadding="3" align="center">
<tr>
<td height="230" valign="top">
<%
                 w=1
             set

rs=server.createobject("adodb.recordset")
    sql="select top 15 * from article where

classid=4 order by hits desc"
    rs.open sql,conn,1,1
if rs.eof and rs.bof then
    response.write "<p align=center>??2??e!?Yê±

??óD×ê??"
else
    do while not rs.eof
response.write "?¤<a

href=list.asp?articleid="&rs("articleid")&"

title="&rs("title")&">"&left(rs("title"),30)&"</a><br

>"
    
    rs.movenext
    loop
end if
rs.close
                 %>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="100%" height="10">
<div align="center"></div>
</td>
</tr>
</table>
</td>
<td width="550" valign="top" bgcolor="#FFFFFF">
<table width="480" border="0" cellspacing="0"

cellpadding="5" height="100" align="center">
<tr>
<td height="100" align="right"

valign="top"><table width="100%" border="0"

cellspacing="0" cellpadding="0">
<tr>
<td><b><font

color="#FF3300"><%=nclassname%></font></b></td>
</tr>
</table>
<table width="530" border="0"

cellspacing="0" cellpadding="0" align="center">
<tr>
<td width="240" valign="top"><%
        sql="select * from article where

nclassid="&cstr(nclassid)&" and

classid="&cstr(classid)&" order by articleid desc"
        rs.open sql,conn,1,1
        writer=rs("writer")
        email=rs("email")
        url=rs("url")
        www=rs("www")

        if rs.eof and rs.bof then
    response.write "<p align='center'>??óD?ò??óD?

òμ?è?o?????</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,"indexlink.asp"
        else
        if

(currentPage-1)*MaxPerPage<totalPut then
            rs.move

(currentPage-1)*MaxPerPage
            dim bookmark
            bookmark=rs.bookmark
            showContent
            showpage

totalput,MaxPerPage,"indexlink.asp"
        else
             currentPage=1
            showContent
            showpage

totalput,MaxPerPage,"indexlink.asp"
             end if
         end if
    rs.close
    end if
    
    set rs=nothing
    sub showContent
    dim i
         i=0
        do while not rs.eof
%>
?¤<a href="list.asp?articleid=<%=rs("articleid")%>"

title="<%=rs("title")%>" target="_blank">
<%if len(rs("title"))>30 then %>
<%=left(rs("title"),30)%>?-
<%else%>
<%=rs("title")%>
<%end if%>
</a> <font color="#999999">[
<%
    response.write "<font

color=#808080>"&rs("dateandtime")&"</font>&nbsp;"
    %>
]</font><font color="#006699">&nbsp;
</font></td>
<td width="290" valign="top">&nbsp;

</td>
</tr>
</table>
<%
     i=i+1
     if i>=MaxPerPage then exit do
         rs.movenext
     loop
%>
<%
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
    response.write "<form method=Post

action="&filename&"?classid="&classid&"&nclassid="&nc

lassid&">"
    if CurrentPage<2 then
        response.write "&nbsp;&nbsp;&nbsp;ê×

ò3 é?ò?ò3&nbsp;"
    else
        response.write

""&totalnumber&"?a&nbsp;<a

href="&filename&"?page=1&classid="&classid&"&nclassid

="&nclassid&">ê×ò3</a>&nbsp;"
        response.write "<a

href="&filename&"?page="&CurrentPage-1&"&classid="&cl

assid&"&nclassid="&nclassid&">é?ò?ò3</a>&nbsp;"
    end if
    if n-currentpage<1 then
        response.write "??ò?ò3 ?2ò3"
    else
        response.write "<a

href="&filename&"?page="&(CurrentPage+1)&"&classid="&

classid&"&nclassid="&nclassid&">"
        response.write "??ò?ò3</a> <a

href="&filename&"?page="&n&">?2ò3</a>"
    end if
    response.write "&nbsp;<strong><font

color=#ff0000>"&CurrentPage&"</font>/"&n&"</strong>ò3

"
%>
<select name='page' size='1'

style='background-color: #c0c0c0'

onChange='javascript:submit()'>
<%for i = 1 to n%>
<option value='<%=i%>' <%if

cint(Page)=cint(i) then%> selected <%end if%>>μú

<%=i%>ò3</option>
<%next%>
</select>
<%
end function
%></td>
</tr>
</table>
</td>
</tr>
</table>



缺缺

职务:管理员
等级:8
金币:41.0
发贴:9620
#22004/4/1 13:24:24
<%
i = 1
while not(rs.bof or rs.eof)
%>                

<td width="20%" valign="top">
<%=内容%></td>

<%
if i mod 2 = 0 then response.Write("</tr><tr>")
i = i + 1
rs1.movenext
wend

%>