smallclass.asp

来自「这是一个学生毕业时做的教务系统」· ASP 代码 · 共 297 行

ASP
297
字号
<%@ Language=VBScript%>

<!--#include file=include/conn.asp -->
<%
request_BigClassID=Request.QueryString("BigClassID")
request_BigClassName=trim(Request.QueryString("BigClassName"))
request_SmallClassID=Request.QueryString ("SmallClassID")
request_SmallClassName=trim(Request.QueryString("SmallClassName"))

       PageShowSize = 10            '每页显示多少个页
       MyPageSize   = 24           '每页显示多少条新闻
	   
       If Not IsNumeric(Request("page")) Or IsEmpty(Request("page")) Or Request("page") <=0 Then
             MyPage=1
       Else
             MyPage=Int(Abs(Request("page")))
       End if


set rs=server.CreateObject("ADODB.RecordSet")
rs.Source="select * from BigClass order by BigClassID"
rs.Open rs.Source,conn,1,1

dim ArrayBigClassID(20),ArrayBigClassName(20)
BigClassCount=rs.RecordCount
for i=1 to BigClassCount
ArrayBigClassID(i)=rs("BigClassID")
ArrayBigClassName(i)=trim(rs("BigClassName"))
rs.MoveNext
next


set rs2=server.CreateObject("ADODB.RecordSet")  '专题
rs2.Source="select Top 10 * from Special  order by SpecialID DESC "
rs2.Open rs2.Source,conn,1,1


set rs4=server.CreateObject("Adodb.RecordSet")
rs4.source="select * from SmallClass Where BigClassName='" & request_BigClassName &"' order by SmallClassID"
rs4.open rs4.source,conn,1,1

SmallClassCount=rs4.RecordCount
dim ArraySmallClassID(20),ArraySmallClassName(20)
for i=1 to SmallClassCount
ArraySmallClassID(i)=rs4("SmallClassID")
ArraySmallClassName(i)=trim(rs4("SmallClassName"))
rs4.MoveNext
next
rs4.Close
set rs4=nothing


%>
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title><%=request_SmallClassName%>__<%=request_BigClassName%>__<%=redcaff%></title>
<LINK href=news.css rel=stylesheet>
<link href="../css.css" rel="stylesheet" type="text/css">
<link href="css.css" rel="stylesheet" type="text/css">
</head>

<body topmargin="0">
<!--#include file=include/top.asp -->




<table width="778" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr> 
    <td width="5" rowspan="2" background="images/bgimg_left.gif">&nbsp;</td>
    <td width="416"><table width="768" height="25" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
        <tr bgcolor="f4f4f4" class="box"> 
          <td width="160">&nbsp;</td>
          <td width="608" height="22"><font color="#000000">当前位置:</font><font color="#FFFFFF"><a href="./" class=bai1 >首页</a><font color="#000000">&gt;&gt;</font></font><a class=bai1 href="BigClass.asp?BigClassID=<%=request_BigClassID%>&amp;BigClassName=<%=request_BigClassName%>" ><%=request_BigClassName%></a><font color="#000000">&gt;&gt;</font><%=request_SmallClassName%></td>
        </tr>
      </table></td>
    <td width="5" rowspan="2" background="images/bgimg_right.gif">&nbsp;</td>
  </tr>
  <tr> 
    <td height="253">
<table width="768" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
        <tr> 
          <td width="160" align="center" valign="top" bgcolor="f4f4f4" > 
            <table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#F4f4f4">
              <tr> 
                <td width="160" height="38"> <table width="100%" border="0" align=center cellpadding="0" cellspacing="0">
                    <tr> 
                      <td width="100%" bgcolor="#ffffff" > <table width="100%" border="0" cellspacing="0" cellpadding="0">
                          <tr> 
                            <td height="40" align="left" background="images/sousuo.gif"> 
                              <div align="left"></div></td>
                          </tr>
                        </table></td>
                    </tr>
                    <form action=search.asp method=post target=_blank id=form1 name=form1>
                      <tr> 
                        <td width="100%" align=center height="25" valign="middle"><table width="100%" border="0" cellpadding="0" cellspacing="0">
                            <tr> 
                              <td height="30" bgcolor="#f4f4f4"> 
                                <div align="center"> 
                                  <select size=1 name=WhichClass style=font-size:9pt;position:relative;width:110;height:23>
                                    <option value=>请选择搜索类别</option>
                                    <option value=0 selected>所有类别</option>
                                    <%for i=1 to BigClassCount%>
                                    <option value=<%=ArrayBigClassID(i)%>><%=ArrayBigClassName(i)%></option>
                                    <%next%>
                                  </select>
                                </div></td>
                            </tr>
                            <tr> 
                              <td height="50" bgcolor="#F4f4f4"> 
                                <div align="center"> 
                                  <input type=text name=keyword size=14>
                                  <br>
                                  <input  name=submit1 type=image src=images/serch.gif width="52" height="18">
								  
                                </div></td>
                            </tr>
                          </table></td>
                      </tr>
                    </form>
                  </table></td>
              </tr>
              <tr> 
                <td height="11" background="images/bt_bg.gif"></td>
              </tr>
              <tr> 
                <td height="39"><table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#F4f4f4">
                    <tr> 
                      <td height="40" background="images/smallclass.gif">&nbsp;</td>
                    </tr>
                    <tr> 
                      <td><table width="100%" border="0" align=center cellpadding="1" cellspacing="0">
                         
                          <tr> 
                            
                              <%
for i=1 to SmallClassCount
Response.Write "<tr><td align=center bgcolor=#f4f4f4><a class=bai1 href='SmallClass.asp?BigClassID=" & request_BigClassID & "&BigClassName="& request_BigClassName & "&SmallClassID=" & ArraySmallClassID(i)& "&SmallClassName="& ArraySmallClassName(i) &"'>" & ArraySmallClassName(i) & "</a></td></tr>"
next
%>
                          
                          </tr>
                        </table></td>
                    </tr>
                  </table></td>
              </tr>
              <tr> 
                <td height="11" background="images/bt_bg.gif"></td>
              </tr>
              <tr> 
                <td height="65" bgcolor="f4f4f4"> 
                  <table width="100%" border="0" cellspacing="0" cellpadding="0">
                    <tr> 
                      <td height="40" background="images/zhuanti.gif">&nbsp;</td>
                    </tr>
                    <tr> 
                      <td bgcolor="f4f4f4"> <table width="100%" height="45" border="0" cellpadding="0" cellspacing="0">
                          <tr> 
                            <td height="5"></td>
                            <%
while not rs2.EOF

TrString="<tr><td width=100% height=18 bgcolor=#F4F4F4>&nbsp;&nbsp;<font color=#5284AD><img src=images/icon_arrow_04.gif></font><a class=BAI1 href=Special_News.asp?SpecialID=" & rs2("SpecialID") &"&SpecialName="& rs2("SpecialName") &">&nbsp;" & trim(rs2("SpecialName")) & "</a></td></tr>"
Response.Write TrString

rs2.MoveNext
wend

rs2.Close
set rs2=nothing
%>
                          </tr>
                          <tr> 
                            <td height="10" bgcolor="#F4F4F4"> <div align="right" class="bai1"><a href=special.asp class="bai1">更多专题...</a></div></td>
                          </tr>
                          <tr> 
                            <td height="11" background="images/bt_bg.gif"></td>
                          </tr>
                        </table></td>
                    </tr>
                  </table>
                </td>
              </tr>
            </table>
          </td>
          <td width="607" align="center" valign="top"> 
            <table width="90%" border="0" align="center" cellpadding="1" cellspacing="0">
              <%


set rs3=server.CreateObject("ADODB.RecordSet")

rs3.Source="select NewsID,Title,UpdateTime,BigClassName,SmallClassName,SpecialID,click from News where SmallClassName='" & request_SmallClassName &"' order by NewsID DESC"
rs3.Open rs3.Source,conn,1,3
       Rs3.PageSize     = MyPageSize
       MaxPages         = Rs3.PageCount
       Rs3.absolutepage = MyPage
       total            = Rs3.RecordCount
%>
              <tr> 
                <td width=100% height="30" valign="middle">&nbsp;当前第 <%=Mypage%>/<%=Maxpages%> 
                  页,每页 <%=MyPageSize%> 条</td>
              </tr>
              <%
       If Not rs3.eof then
              i = 0
              do until rs3.Eof or i = rs3.PageSize
%>
              <tr> 
                <td width="100%" height="20"><img src=images/arrow.gif width="25" height="8" border="0"><a class=bai1 href="ReadNews.asp?NewsID=<%=rs3("NewsID")%>&BigClassName=<%=rs3("BigClassName")%>&SmallClassName=<%=rs3("SmallClassName")%>&SpecialID=<%=rs3("SpecialID")%>" target=_blank> 
                  <%=trim(rs3("Title"))%></a><font color="#666666">(<%=trim(rs3("UpdateTime"))%>)[<font color="#ff0000"><%=trim(rs3("click"))%></font>]</font></td>
              </tr>
              <%
                rs3.MoveNext
                i = i + 1
                loop
%>
              <tr> 
                <td width="100%">&nbsp; </td>
              </tr>
              <tr> 
                <td width="100%" align=center> 
                  <%
url="SmallClass.asp?BigClassName=" & request_BigClassName & "&SmallClassName=" & request_SmallClassName									
PageNextSize=int((MyPage-1)/PageShowSize)+1
Pagetpage=int((total-1)/rs3.PageSize)+1

   if PageNextSize >1 then
         PagePrev=PageShowSize*(PageNextSize-1)
         Response.write "<a class=bai1 href='" & Url & "&page=" & PagePrev & "' title='上" & PageShowSize & "页'>上一翻页</a> "
         Response.write "<a class=bai1 href='" & Url & "&page=1' title='第1页'>页首</a> "
   end if
   if MyPage-1 > 0 then
         Prev_Page = MyPage - 1
         Response.write "<a class=bai1 href='" & Url & "&page=" & Prev_Page & "' title='第" & Prev_Page & "页'>上一页</a> "
   end if

   if Maxpages>=PageNextSize*PageShowSize then
        PageSizeShow = PageShowSize
   Else
        PageSizeShow = Maxpages-PageShowSize*(PageNextSize-1)
   End if
   If PageSizeShow < 1 Then PageSizeShow = 1
   for PageCounterSize=1 to PageSizeShow
         PageLink = (PageCounterSize+PageNextSize*PageShowSize)-PageShowSize
         if PageLink <> MyPage Then
              Response.write "<a class=bai1 href='" & Url & "&page=" & PageLink & "'>[" & PageLink & "]</a> "
         else
              Response.Write "<B>["& PageLink &"]</B> " 
         end if 
         If PageLink = MaxPages Then Exit for
   Next

   if Mypage+1 <=Pagetpage  then
          Next_Page = MyPage + 1
          Response.write "<a class=bai1 href='" & Url & "&page=" & Next_Page & "' title='第" & Next_Page & "页'>下一页</A>"
   end if

   if MaxPages > PageShowSize*PageNextSize then
          PageNext = PageShowSize * PageNextSize + 1
          Response.write " <A class=bai1 href='" & Url & "&page=" & Pagetpage & "' title='第"& Pagetpage &"页'>页尾</A>"
          Response.write " <a class=bai1 href='" & Url & "&page=" & PageNext & "' title='下" & PageShowSize & "页'>下一翻页</a>"
   End if

				
       End If
       Rs3.close

%>
                </td>
              </tr>
              <tr> 
                <td width="100%" align=center>&nbsp;</td>
              </tr>
              <tr> 
                <td width="100%"></td>
              </tr>
            </table>
          </td>
        </tr>
      </table></td>
  </tr>
</table>
<table width="780" height="1" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td width="5" height="1" background="images/bgimg_left.gif"></td>
    <td height="1" bgcolor="cccccc"></td>
    <td width="5" height="1" background="images/bgimg_right.gif"></td>
  </tr>
</table>
<!--#include file=include/bottom.asp -->
</body>

</html>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?