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

📄 drawdiv.asp

📁 网络程序-学生个人信息管理系统。以学生个人用户实际需要为中心
💻 ASP
字号:
<%
function drawdiv(ii,mypagenum)
   funvolum=cint(trim(ii))'进行数字化处理是非常必要的,否则下面的分页会出现问题
   funpagenum=cint(trim(mypagenum))'
'-----------------
if mypagenum=-1 then '若非请求栏目输出
mypagenum=1
end if
'------------------------------
serch="<form name=""frm_Search"" method=""get"" action=""Search.asp"" ><table  border=""0"" align=""left""><tr><TD><input  name=""key"" type=""text"" size=""30""  onFocus=""if (this.value=='your keywords here') this.value=''""; onBlur=""if (!this.value) this.value='your keywords here'"" value=""your keywords here"" style=""border: 1px dotted #FFFFFF; ""></td><td><input type=""submit"" value=""Search"" ></td></tr></table></form>"

'-----------------------------

set rst2 = Server.CreateObject("ADODB.Recordset")
    rst2.ActiveConnection=my_conn
sql="select name,content from info where english_name='colortd'" 
rst2.Open sql,my_conn,1,1 '是否打开了光标

if rst2("content")=1 then
rst2.close
sql="select name,content from info where english_name='color'" 
rst2.Open sql,my_conn,1,1 '再来查询光标色彩
tdcolor=rst2("content")
rst2.close
else
tdcolor=""
rst2.close
end if
'-----------------------------
sql="select name,content from info where english_name='navipic'" 
rst2.Open sql,my_conn,1,1 '是否使用导航图片

if rst2("content") <> "0" then
navipic="<td width=""2%""><img src="&rst2("content")&"></td>"'存储图片路径
end if
rst2.close
'----------------------------
'----------------------------
sql="select name,content from info where english_name='menucolor'" 
rst2.Open sql,my_conn,1,1 '查询menu背景色
menucolor=rst2("content")
rst2.close
'-----------------------------
sql="select name,content from info where english_name='linedashed'" 
rst2.Open sql,my_conn,1,1 '是否虚线显示

if rst2("content")=1 then
tdline="BORDER-TOP: #ffffff  1PX DASHED;"
rst2.close
else
tdline=""
rst2.close
end if
'----------------------------
'-----------------------------
sql="select name,content from info where english_name='perpage'" 
rst2.Open sql,my_conn,1,1 '是否分页

if rst2("content")=0 then
perpage=100000000'一亿条,当做无穷使用
rst2.close
else
perpage=cint(rst2("content"))
rst2.close
end if

'----------------------------
'下面查询输出内容
set rst1 = Server.CreateObject("ADODB.Recordset")
rst1.ActiveConnection=my_conn
sql="select ID,name,content,date from data where fatherid="&ii&" order by date desc" 
rst1.Open sql,my_conn,1,1 '得到搜索后的记录

'----------------------------
'分页过程-------------
rst1.pagesize=perpage'设置每一页大小
pagecount=rst1.pagecount '获得总页数

if funpagenum <1 then
funpagenum=1        
else
rst1.absolutepage=funpagenum '跳转到第几页
end if 
'分页 ---------------- 

dim answer
if rst1.EOF and  rst1.BOF then
      Response.Write "文章数为零~"
      rst1.close
    else
j=1
do while not rst1.eof and j<=perpage '这里才是设置页面长度的

answer=answer & "<table cellspacing=""0"" width=""100%"" style='BORDER-LEFT: #ffffff 1PX DASHED; BORDER-RIGHT: #ffffff  1PX DASHED;"&tdline&" '>"
answer=answer&"<tr onmouseover=""style.backgroundColor='"&tdcolor &"';"" onmouseout=""style.backgroundColor='';"" >" & navipic & "<td width=""70%"" >" & "<a class=""style3"" href=detail.asp?id="&rst1("ID")& ">" & rst1("name")& "</a></td><td align=""right"" class=""style3"">" & rst1("date")& "</td></tr>"
answer=answer & "</table>"

rst1.movenext
j=j+1 
loop 
rst1.close
end if
'-----------------
'首先判断是否需要输出分页
if perpage<>100000000 then '若是10000000则说明是不分页面
  
'下面输出分页标号
'-----------------
  if pagecount <> 0 then '若页面数大于0(第一页),则有分页
    answer=answer & "<table style='BORDER-TOP: #ffffff 1PX DASHED;BACKGROUND:"&menucolor&"; ' height=""20"" align=""center""><tr><td width=""100%"" height=""27"" ><div align=""left""><span class=""style1""> [第"&funpagenum&"页/共"&pagecount&"页]</span> <span class=""style1"">"
    if funpagenum > 1 then
      answer=answer&"  <a class=""style1"" href=body.asp?pagenum="&funpagenum-1& "&" & "volum="& funvolum &"><<</a>"
    else
      answer=answer&"||"
    end if

    if funpagenum < pagecount then 
       answer=answer&"<a  class=""style1"" href=body.asp?pagenum="&funpagenum+1 & "&" & "volum="& funvolum &"> >></a>"
    else 
       answer=answer&"||</span>"
    end if
    answer=answer&"</div></td><td>"&serch&"</td><td><input type=""button""  onclick=""location.href='../login/login.asp';""  value=""Login"" ><input type=""button""  onclick=""location.href='../input/addbox.asp';""  value=""添加文章"" ></td></tr></table>"
  end if
else'不分页,只输出菜单
     answer=answer&"<table style='BORDER-TOP: #ffffff 1PX DASHED;BACKGROUND: "&menucolor&"; ' height=""20"" ><tr><td width=""100%"" height=""27"" ></td>"
     answer=answer&"<td>"&serch&"</td><td><input type=""button""  onclick=""location.href='../login/login.asp';""  value=""Login"" ><input type=""button""  onclick=""location.href='../input/addbox.asp';""  value=""添加文章"" ></td></tr></table>"
end if
'----------------
drawdiv=answer
end function
%>

⌨️ 快捷键说明

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