⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 default.asp

📁 21世纪人才www.51zy.net 网站源码
💻 ASP
字号:
<!--#include file = "Include/DBClass.inc.asp"-->

<%
' =============================================================
' Made By Xiasp & 21世纪人才周刊 http://www.sxzx.net/ QQ群:8617001
' =============================================================
%>

<%
Call Header(""&Homepage_Title&" - 新闻列表")
Call Content()
Call Footer()

' 开始写入内容
Sub Content()

Dim s_keyword, s_cataid
s_keyword = GetSafeStr(Trim(Request("keyword")))
s_cataid = GetSafeInt(Trim(Request("cataid")),1)

Dim Pmcount,Pageno
'//设置新闻显示数量
Pmcount = News_Front_Count

%>

<SCRIPT language=javascript>
<!--
  function mOvr(src,clrOver) {
    if (!src.contains(event.fromElement)) {
	  src.bgColor = clrOver;
	}
  }
  function mOut(src,clrIn) {
	if (!src.contains(event.toElement)) {
	  src.bgColor = clrIn;
	}
  }
// -->	
</SCRIPT>

<!--#include file = "../Include/Header.asp"-->
<table width="778" border="0" cellspacing="0" cellpadding="0" align="center" bgcolor="#FFFFFF">
  <tr> 
    <td height="100" background="../images/av_news.jpg"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="777" height="100">
        <param name=movie value="../images/movie.swf">
        <param name=quality value=high>
        <param name="wmode" value="transparent">
        <param name="menu" value="false">
        <embed src="../images/movie.swf" quality=high pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="777" height="100" wmode="transparent" menu="false">
        </embed> 
      </object></td>
  </tr>
</table>
<table cellspacing=0 cellpadding=0 width=777 align=center border=0 bgcolor="#FFFFFF">
  <tbody> 
  <tr> 
    <td valign=top width=200 bgcolor=#f5f5f5> 
      <table cellspacing=0 cellpadding=0 width="100%" border=0>
        <tbody> 
        <tr> 
          <td background="images/bg_1.gif" height=25> 
            <div align="center"><b><font color="#cc0000">□ 信息栏目导航</font></b></div>
          </td>
        </tr>
        <tr> 
          <td background="../images/line_3.gif" height=1></td>
        </tr>
        <tr> 
          <td bgcolor=#f5f5f5 height=30>&nbsp;</td>
        </tr>
        <tr> 
          <td height=1> 
            <table cellspacing=0 cellpadding=0 width="80%" align=center border=0>
              <tbody> 
              <tr> 
                <td width="100%" background="../images/line_3.gif" height=1></td>
              </tr>
              </tbody> 
            </table>
          </td>
        </tr>
		<%
		Dim mRs, mSql, mRootID, mLen 
		set mRs = server.CreateObject("adodb.recordset")
		mSql="SELECT * FROM NewsCata ORDER BY C_ID DESC"
		mRs.Open mSql,oConn,1,1
			Do While Not mRs.Eof
			mRootID = mRs("C_RootID")
			mLen = Len(mRootID)
			If mLen = 4 Then			
  
				tempcataStr="<tr valign=center align=middle bgcolor=#ffffff>"
				tempcataStr=tempcataStr&"<td onMouseOver=mOvr(this,'#ffffff'); onMouseOut=mOut(this,'#f5f5f5'); bgcolor=#f5f5f5 height=25>"
				tempcataStr=tempcataStr&"<div align=right><a href=default.asp?cataid="&Trim(mRs("C_ID"))&">"&Trim(mRs("C_Title"))&"</a> <img src='../images/pot_11.gif'>&nbsp;&nbsp;&nbsp;&nbsp;</div></td>"
       			tempcataStr=tempcataStr&"<tr>"
          		tempcataStr=tempcataStr&"<td bgcolor=#f5f5f5>"
            	tempcataStr=tempcataStr&"<table cellspacing=0 cellpadding=0 width=80% align=center border=0>"
              	tempcataStr=tempcataStr&"<tbody>" 
              	tempcataStr=tempcataStr&"<tr> "
                tempcataStr=tempcataStr&"<td width='100%' background='../images/line_3.gif'  height=1></td>"
              	tempcataStr=tempcataStr&"</tr>"
              	tempcataStr=tempcataStr&"</tbody>" 
            	tempcataStr=tempcataStr&"</table>"
          		tempcataStr=tempcataStr&"</td>"
        		tempcataStr=tempcataStr&"</tr>"
				
				Response.Write tempcataStr
			End if
			
			mRs.MoveNext
			Loop 
		
  		mRs.Close
  		set mRs = Nothing
		%>
        <tr> 
          <td height=30> 
          </td>
        </tr>
        </tbody> 
      </table>
      </td>
    <td valign=top style="border-left:1px #000000 dotted"><br>
      <table cellspacing=0 cellpadding=0 width=596 border=0>
        <tbody> 
        <tr> 
          <td valign=top> 
            <table cellspacing=0 cellpadding=0 width="96%" align=center border=0>
              <tbody> 
              <tr> 
                <td><img src="../images/title_news.gif" width="550" height="78"></td>
              </tr>
              <tr> 
                <td valign="top">
                  <table width="100%" border="0" cellspacing="10" cellpadding="0">
                    <tr> 
                      <td> 
                        <table width="100%" border="0" cellspacing="0" cellpadding="0">
                          <tr>
                            <td>
							
<%
'开始读取当前位置的信息

	Response.write "当前类别:"			  
		If s_cataid > 1 then
			Dim aRs, aSql, aID, aRootID, aTitle, aLen, i, bRootID, bRs, bSql, bID, bTitle
			'开始读去指定新闻类别的RootID
			Set aRs = Server.CreateObject( "ADODB.Recordset" )
			aSql = "SELECT * FROM NewsCata WHERE C_ID = "&s_cataid
			aRs.Open aSql, oConn, 0, 1
			If Not aRs.Eof Then
				aRootID = aRs("C_RootID")
				aTitle = aRs("C_Title")
				aID = aRs("C_ID")
				
				Response.Write "<a href='Default.asp'>全部信息</a>"
				aLen = Len(Trim(aRootID))/4
				If aLen > 1 Then
					For i = 1 To aLen -1
						bRootID = Mid(aRootID,1,4*i)
						
						'开始读去指定新闻类别的父类别的信息
						Set bRs = Server.CreateObject( "ADODB.Recordset" )
						bSql = "SELECT * FROM NewsCata WHERE C_RootID = '"&bRootID&"'"
						bRs.Open bSql, oConn, 0, 1
						If Not bRs.Eof Then
							bID = bRs("C_ID")
							bTitle = bRs("C_Title")
						End If
						bRs.Close
						Set bRs = Nothing
						Response.Write ("&nbsp;&gt;&gt;&nbsp;<a href='Default.asp?cataid="& bID &"'>"& bTitle &"</a>")
					Next
				End If
				Response.Write "&nbsp;&gt;&gt;&nbsp;<font color='FF0000'>"& aTitle &"</font>"
			End If
			aRs.Close
			Set aRs = Nothing
		Else
			Response.Write "<font color='FF0000'>全部信息</font>"
		End if
%> 

<%
'计算当前类别的子类别
If s_cataid > 1 then
	Dim dRs, eRs, dSql, eSql, eID, dRootID, eRootID, dLen, AllCataID
	Set dRs = Server.CreateObject( "ADODB.Recordset" )
	dSql = "SELECT * FROM NewsCata WHERE C_ID = "&s_cataid
	dRs.Open dSql, oConn, 0, 1
	If Not dRs.Eof Then
		dRootID = dRs("C_RootID")
	End If
	dRs.Close
	Set dRs = Nothing
	
	dLen = Len(Trim(dRootID))
	AllCataID = ""
	
	Set eRs = Server.CreateObject( "ADODB.Recordset" )
	eSql = "SELECT * FROM NewsCata ORDER BY C_RootID"
	eRs.Open eSql, oConn, 0, 1	
	Do While Not eRs.Eof
		eRootID = eRs("C_RootID")
		eID = eRs("C_ID")
		If Mid(eRootID,1,dLen) = dRootID Then
			AllCataID = AllCataID & " or D_CataID = "& eID
		End If
	eRs.Movenext
	Loop
	eRs.Close
	Set eRs = Nothing
	AllCataID = Trim(Mid(AllCataID,4))
End If
%>

                          </td>
                          </tr>
                        </table>
                        <table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#E1F0FF">
                          <form name="search" method="post" action="Default.asp">
                            <tr> 
                              <td height="20" width="3%" valign="bottom"> 
                                <div align="right"></div>
                              </td>
                              <td height="20" width="97%"> 
                                <div align="center">信息搜索--&gt;&gt;&gt; 关键词: 
                                  <input type="text" name="keyword" class="button1" size="20" value="<%=s_keyword%>" onMouseOver=this.focus() onFocus=this.select()>
                                  栏目: 
                                  <select name="cataid" onChange="javascript:document.search.submit();">
                                    <option value=''>---> 信息快递 <---</option>
<%
	'开始读取数据库中已经定义的新闻类别
	'其实这么写,感觉太没有效率了,应该定义一个子程序
	
	Dim cRs, cSql, j, TempCataStr
	Set cRs = Server.CreateObject( "ADODB.Recordset" )
	cSql = "SELECT * FROM NewsCata WHERE C_ID <> 1 ORDER BY C_RootID"
	cRs.Open cSql, oConn, 1, 3
	Do While Not cRs.EOF	
		TempCataStr = "<option value='"&Trim(cRs("C_ID"))&"'"
		If Trim(cRs("C_ID")) = Trim(s_cataid) Then TempCataStr = TempCataStr&" selected"
		TempCataStr = TempCataStr&">"
		TempCataStr = TempCataStr&"&nbsp;|&nbsp;|"
		
		For j = 1 To Int(Len(Trim(cRs("C_RootID")))/4) - 1
			TempCataStr = TempCataStr&"&nbsp;|"
		Next

		TempCataStr = TempCataStr&"_"&Trim(cRs("C_Title"))&"</option>"
		Response.Write TempCataStr
			
	cRs.MoveNext
	Loop 
  	cRs.Close
  	Set cRs = Nothing
%>
                                  </select>
                                  <input type="image" border="0" name="imageField" src="images/search.gif" width="39" height="18">
                                </div>
                              </td>
                            </tr>
                          </form>
                        </table>
                        <br>
                        <table width="100%" border="0" cellspacing="0" cellpadding="0" bordercolordark="#FFFFFF" bordercolorlight="#000000" style="word-break:break-all;">
<%
If s_cataid = 1 Then
	If s_keyword <> "" Then
		sSql = "SELECT * FROM NewsData WHERE D_Title LIKE '%"&s_keyword&"%' ORDER BY D_SortID DESC"
    Else
		sSql = "SELECT * FROM NewsData ORDER BY D_SortID DESC"
	End If
Else
	If s_keyword <> "" Then
		sSql = "SELECT * FROM NewsData WHERE ("&AllCataID&") and D_Title LIKE '%"&s_keyword&"%' ORDER BY D_SortID DESC"
    Else
		sSql = "SELECT * FROM NewsData WHERE ("&AllCataID&") ORDER BY D_SortID DESC"
	End If
End if

oRs.Open sSql, oConn, 1, 1

Dim Rcount, Loopno, Mpage
Rcount = oRs.Recordcount

If Pmcount="" or isempty(Pmcount) or Pmcount<1 then
        Pmcount=20
End If
	oRs.Pagesize = pmcount   	'设置每页数
	Mpage = oRs.Pagecount    	'得到总页数
	Pageno = GetSafeInt(Clng(Request("Pageno")),1)
	
If Cint(Pageno) < 1  Then Pageno = 1
If Cint(Pageno) > Mpage Then Pageno = Mpage

If oRs.Bof and oRs.Eof then
	Response.write "<tr><td colspan='6'>&nbsp;&nbsp;暂时没有任何新闻!</td></tr>"
Else
	oRs.Absolutepage = Pageno	'将指针移至指定页的第一条记录
	Loopno = Pmcount
	Do While Not oRs.Eof and Loopno > 0
%>
                          <tr> 
                            <td width="3%" height="24"><img height=6 src="../images/pot_1.gif" width="4" nowrap></td>
							<td width="97%" background="images/bg.gif" height=24> 
                              <a href='Show.asp?id=<%=oRs("D_ID")%>' class='tt1' target='_blank'><%Response.Write oRs("D_Title")%></a> 
                              <%
							if Trim(oRs("D_SavePathFileName"))<>"" then
								Response.Write " <img src='images/news.gif' border=0>"
							end if
							%>
                              <a title="<%=oRs("D_AddTime")%>"><font color="#FF9900">[ 
                              </font><font color=#FF9900><%=FormatDateTime(oRs("D_AddTime"),vbshortdate)%> 
                              浏览:<%=oRs("D_Hits")%> ]</font></a></td>
                          </tr>
<%
		oRs.Movenext						
		Loopno=Loopno-1
		Loop		
		
		oRs.Close
		Set oRs=Nothing
End if
%>
                        </table>

                        <br>
                        <table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#E1F0FF">
                          <form name="pageform" method=get action="Default.asp">
                            <tr>
                              <td height="25">
                                <div align="left">&nbsp;&nbsp;共&nbsp;<%=Cstr(rcount)%>&nbsp;条新闻&nbsp;当前为:<font color="#FF0000"><%=Cstr(Pageno)&"</font>/"&Cstr(Mpage)%>页 每页 <%=pmcount%> 条</font></div></td>
                              <td>
                                <div align="right">
                                  <%If Cint(Pageno)>1 Then%>
                                  <font face="Webdings" color="#FF0000">7</font>&nbsp;<a href='Default.asp?cataid=<%=s_cataid%>&keyword=<%=s_keyword%>&pageno=<%=Pageno-1%>' class="tt5">上一页</a>
                                  <%End If
								  If Cint(Pageno) < Cint(Mpage) Then
								  %>
                                  <font face="Webdings" color="#FF0000">8</font>&nbsp;<a href='Default.asp?cataid=<%=s_cataid%>&keyword=<%=s_keyword%>&pageno=<%=Pageno+1%>' class="tt5">下一页</a>
                                  <%End If%>
          跳到第&nbsp;<input type=text size=3 name="pageno" value="<%=pageno%>" class="button1">&nbsp;页&nbsp;<input name="imageField2" type="image" src="../Images/Go.gif" border="0" align="absmiddle">
                              </font></div></td>
                            </tr>
                          </form>
                        </table></td>
                    </tr>
                  </table>
                </td>
              </tr>
              </tbody> 
            </table>
          </td>
        </tr>
        </tbody> 
      </table>
      <table cellspacing=0 cellpadding=0 width="100%" border=0>
        <tbody> 
        <tr> 
          <td bgcolor=#9ac7cf height=1></td>
        </tr>
        </tbody>
      </table>
    </td>
  </tr>
  </tbody>
</table>
<!--#include file = "../Include/Footer.asp"-->
<%
End Sub
%>

⌨️ 快捷键说明

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