www.gusucode.com > 学校共青团组织网站源代码 > 学校共青团组织网站源代码/626/so1.asp

    <!--#include file = admin_conn.asp -->
<%
Set rs = Server.CreateObject("ADODB.RecordSet")
rs.Open "select * from [config]",conn,1,1
if rs.recordcount<>0 then
  sotop=rs("sotop")
  sobottom=rs("sobottom")
end if
rs.close
set rs=nothing
Response.Write sotop
%>
<head>
<!--#include file = language.asp -->
<!--#include file = titleb.asp -->
</head>

<style>
<!--
a:link       { font-size: 10.5pt; font-family: 宋体; color: #000000;text-decoration: none; }
a:visited    { color: #000000; font-family: 宋体; font-size: 10.5pt;text-decoration: none; }
a:hover      { font-size: 10.5pt; font-family: 宋体; color: #000000;TEXT-DECORATION: underline; }
body         { font-family: 宋体; color: #000000; font-size: 10.5pt }
p            { color: #000000; font-family: 宋体; font-size: 10.5pt }
td           { font-size: 10.5pt; font-family: 宋体; color: #000000 }
input        { font-size: 10.5pt; font-family: 宋体; color: #000000 }

-->
</style>
<BR><BR>
<table border=0 width=740 align=center><tr><td align=center>
<form method="post" action="so.asp">
<input type="text" name="word" size="25" value=<%=word%>> <input type="submit" value="搜索" name="xuas">
</form>
</td></tr><tr><td>
<%

function titleb(str,strlen)
	dim l,t,c, i
	l=len(str)
	t=0
	for i=1 to l
	c=Abs(Asc(Mid(str,i,1)))
	if c>255 then
	t=t+2
	else
	t=t+1
	end if
	if t>=strlen then
	titleb=left(str,i)&"…"
	exit for
	else
	titleb=str&""
	end if
	next
end function

word=chkhtm(trim(Request("word")))
nnn="<font color='#FF0000'><span style='background-color: #FFFF00'>"&word&"</span></font>"
if word="" then
	sql = "select * from news where title='' order by id desc"
else
	sql = "select * from news where title like '%"&word&"%' order by id desc"
end if

Set rs = Server.CreateObject("ADODB.RecordSet")
rs.Open sql,conn,1,1

if rs.recordcount<>0 then 

page=int(request.QueryString ("page"))
rs.PageSize=10
pagecount=rs.pagesize
if page<=0 then page=1
if request.QueryString("page")="" then page=1
rs.AbsolutePage=page
%>
<%
    for i=0 to pagecount
         sql2 = "select * from lm where id="&rs("lm")
         Set rs2 = Server.CreateObject("ADODB.RecordSet")
         rs2.Open sql2,conn,1,1
         lm=rs2("lm")
         title=replace(rs("title"),word,nnn)
         
         nr=replace(nr,"<","<")
         nr=replace(nr,">",">")
         content=nr
        
    %>
      <font face=Wingdings>1</font>&nbsp;[<%=lm%>]&nbsp;<a href="news_view.asp?newsid=<%=rs("id")%>" target=_top><font color="<%=rs("titlecolor")%>"><%=title%></font></a><font color=999999>(<%=rs("time")%>)</font><BR>
      <font color=999999>
      <%
         if len(content)<400 then
           Response.Write content
         Else
           Response.Write titleb(content,190)
         end if
      %></font><br><br>
    <%
    rs.movenext
    if rs.eof then exit for
    next
else
  response.write "<center><BR><BR><BR>无记录<BR><BR><BR><BR>"
end if
%>
</td></tr></table>
<BR><BR><center>
<%
if rs.recordcount<>0 then
  if page>1 then%>
     <a href='<%=request.servervariables("URL")%>?page=1&word=<%=word%>&id=<%=trim(request("id"))%>&lmname=<%=trim(request("lmname"))%>&open=<%=trim(request("open"))%>&n=<%=trim(request("n"))%>'>首页</a>
     <a href='<%=request.servervariables("URL")%>?page=<%=page-1%>&word=<%=word%>&id=<%=trim(request("id"))%>&lmname=<%=trim(request("lmname"))%>&open=<%=trim(request("open"))%>&n=<%=trim(request("n"))%>'>上一页</a>
  <%end if%>
  <%if page<rs.pagecount then%>
     <a href='<%=request.servervariables("URL")%>?page=<%=page+1%>&word=<%=word%>&id=<%=trim(request("id"))%>&lmname=<%=trim(request("lmname"))%>&open=<%=trim(request("open"))%>&n=<%=trim(request("n"))%>'>下一页</a>
     <a href='<%=request.servervariables("URL")%>?page=<%=rs.pagecount%>&word=<%=word%>&id=<%=trim(request("id"))%>&lmname=<%=trim(request("lmname"))%>&open=<%=trim(request("open"))%>&n=<%=trim(request("n"))%>'>尾页</a>
  <%end if%>
 共<%=rs.recordcount%>条 每页显示<%=pagecount%>条  第<%=page%>页 共<%=rs.pagecount%>页				
    <script language="JavaScript">
      <!--
       function FP_jumpMenu(el,frm,sel) {//v1.0
       var href=el.options[el.selectedIndex].value; if(sel) el.selectedIndex=0;
       if('_new'==frm) open(href); else eval(frm+".location='"+href+"'");
        }
       // -->
     </script>

   <select size="1" onchange="FP_jumpMenu(this,'window',false)" id="id1" name="D1" style="font-size: 9pt; border-style: solid; border-width: 1px">
        <%for i=1 to rs.pagecount%>
          <option value="<%=request.servervariables("URL")%>?page=<%=i%>&word=<%=word%>&id=<%=trim(request("id"))%>&lmname=<%=trim(request("lmname"))%>&open=<%=trim(request("open"))%>&n=<%=trim(request("n"))%>" <%if page=i then response.write "selected"%>>第<%=i%>页</option>
        <%next%>
    </select>
</p>
<%end if%><%
Response.Write sobottom
rs.close
set rs=nothing
conn.close
set conn=nothing
%>