网络编程 | 站长之家 | 网页制作 | 图形图象 | 操作系统 | 冲浪宝典 | 软件教学 | 网络办公 | 邮件系统 | 网络安全 | 认证考试 | 系统进程
Firefox | IE | Maxthon | 迅雷 | 电驴 | BitComet | FlashGet | QQ | QQ空间 | Vista | 输入法 | Ghost | Word | Excel | wps | Powerpoint
asp | .net | php | jsp | Sql | c# | Ajax | xml | Dreamweaver | FrontPages | Javascript | css | photoshop | fireworks | Flash | Cad | Discuz!
当前位置 > 网站建设学院 > 网络编程 > ASP技巧
Tag:注入,存储过程,分页,安全,优化,xmlhttp,fso,jmail,application,session,防盗链,stream,无组件,组件,md5,乱码,缓存,加密,验证码,算法,cookies,ubb,正则表达式,水印,索引,日志,压缩,base64,url重写,上传,控件,Web.config,JDBC,函数,内存,PDF,迁移,结构,破解,编译,配置,进程,分词,IIS,Apache,Tomcat,phpmyadmin,Gzip,触发器,socket
网络编程:ASP教程,ASP.NET教程,PHP教程,JSP教程,C#教程,数据库,XML教程,Ajax,Java,Perl,Shell,VB教程,Delphi,C/C++教程,软件工程,J2EE/J2ME,移动开发
本月文章推荐
.ASP乱码的解决方法 .
.ADO如何取得数据库中表的字段信息.
.处理驱动器和文件夹.
.使用索引服务器 - 创建ASP页面.
.ASP中使用Form和QueryString集合.
.使用Javascript实现邮箱快速登录.
.连接各种数据库的代码的总结.
.将站点加入频道栏源代码.
.使用ASP建立Http组件.
.用ASP语言实现对SQL SERVER 数据.
.在ASP中自动创建多级文件夹的函数.
.实用Server.Transfer轻松用ASP实.
.ORACLE920与ASP的连接问题的解决.
.用ASP编程实现网络内容快速查找.
.了解MSMQ,控制ASP进程 (一).
.利用J2ME与ASP建立数据库连接.
.ADO如何取得数据库中表的字段信息.
.加密你的Access数据库.
.ASP整合的一个SQL语句类.
.SQL注入技术和跨站脚本攻击的检测.

用排序串字段实现树状结构(例程——显示树)

发表日期:2000-8-8


程序index.asp
功能:显示目录树

<!-- #include file="lybcon.inc" --><%
pageno=request("pageno")
searchtype=request("searchtype")
searchnr=rtrim(request("searchnr"))
set guestconn=Server.CreateObject("ADODB.connection")
guestconn.Open lybstr
set guestrs=server.createobject("ADODB.recordset")
sqlstr="SELECT * FROM guestbook"
if searchnr<>"" then sqlstr=sqlstr&" where "&searchtype&" like '%%"&replace(searchnr,"'","''")&"%%'"
sqlstr=sqlstr&" order by rootid+(1-sign(rootid))*lybid desc,orderstr,lybid desc"
guestrs.open sqlstr,guestconn,1,1
rowcount=25
if pageno="" then pageno=1
if not guestrs.eof then
  if IsNumeric(pageno) then
    guestrs.pagesize=rowcount
    if pageno+1>guestrs.pagecount+1 then pageno=guestrs.pagecount
  else
    pageno=1
  end if
  guestrs.AbsolutePage=pageno
else
  pageno=1
end if
%><html>
<head><title>软件使用留言薄</title>
<style TYPE="text/css">
<!--
a {  text-decoration: none}
body {line-height:18px;font-size:9pt;font-family:宋体}
a:hover {color:#FF0000;text-decoration:none}
.submit {line-height:9pt;font-size:9pt;font-family:宋体}
.submit1 {line-height:8pt;font-size:8pt;font-family:宋体}
.selectform {font-family: 宋体; font-size: 9pt;background-color:ffE4E4}
td {font-family: 宋体; font-size: 9pt;background-color:ECF7FF}
.td1 {font-family: 宋体; font-size: 9pt;background-color:A2C8F2}
.td2 {font-family: 宋体; font-size: 9pt;background-color:E9EDE0}
.small1 {font-family: 宋体; font-size: 9pt;background-color:ffffff;line-height:9pt}
-->
</style>
<script language="JavaScript1.2">
function d(sp,t,a,d,ti,l,id,rid,pn)
{
document.write("<tr><td>"+sp+"<a href='disprec.asp?
keyid="+id+"&rootid="+rid+"&pageno="+pn+"'>"+t+"</a></td>");
document.write("<td align=right>"+a+" </td>");
document.write("<td nowrap align=center>"+d+" "+ti+"</td>");
document.write("<td align=right>"+l+" </td>");
document.write("<td align=right>"+id+" </td>");
document.write("</tr>");
}
</script>
</head>
<body topmargin=16>
<form name='index' method='POST' action='index.asp'>
<table width=100% align=center>
  <tr>
   <td align=center style='font-size:16px;background-color:ffffff;color:red' height=35 valign=top>软件使用
留言薄</td>
   <td align=center colspan=3 style='font-size:13px;background-color:ffffff' valign='bottom'>共<font
style='font-size:16px;color:red'><% =guestrs.recordcount %></font>条留言<font style='font-
size:16px;color:red'><% =guestrs.pagecount %></font>页目前第<font style='font-size:16px;color:red'><%
=pageno %></font>页</td>
   <td style='background-color:ffffff' valign=bottom><a href="/wen/swuselyb/index.asp">旧留言薄
</a></td></tr>
  <tr>
   <td class='td2' align='center'>搜索贴子
    <select name='searchtype' class='small1'>
     <option value='guestname' <% if searchtype="guestname" then response.write("selected") %>>贴子作者
</opion>
     <option value='guestcomm' <% if searchtype="guestcomm" then response.write("selected") %>>贴子内容
</opion>
    </select> <input type='text' name='searchnr' size=14 class='small1' value='<% =searchnr %>'> <a
href='javascript:document.index.submit();'>开始搜索</a>
   </td>
   <td colspan=3 class='td2' align='center'><% if pageno+1>2 then %><a
href='javascript:document.index.pageno.value--;document.index.submit();'>上一页</a><% else %>上一页<% end
if %>  <% if pageno+1<guestrs.pagecount+1 then %><a
href='javascript:document.index.pageno.value++;document.index.submit();'>下一页</a><% else %>下一页<% end
if %>  到<input type='text' name='pageno' size=6 class='small1' value=<% =pageno %>>页</td>
   <td class='td2' align=center><a href='revert.asp?type=post'>发贴子</a></td>
  </tr>
  <tr style="color:red">
   <td align=center class='td1'>留言标题</td>
   <td align=center width=70 class='td1'><img src='edit.gif'>作  者</td>
   <td align=center width=100 class='td1'>发表时间</td>
   <td align=center width=60 class='td1' nowrap>贴子字数</td>
   <td align=center width=60 class='td1' nowrap>贴子序号</td>
  </tr>
<%
do while true
  if guestrs.eof then exit do
  if guestrs("rootid")=0 then exit do
  guestrs.movenext
loop
do while not guestrs.eof and rowcount>0 %><script>d('<% =replace(space(2*len(guestrs
("orderstr")))," "," ") %>','<% =guestrs("guestitle") %>','<% =guestrs("guestname") %>','<% =guestrs
("putdate") %>','<% =guestrs("puttime") %>',<% =len(guestrs("guestcomm")) %>,<% =guestrs("lybid") %>,<%
=guestrs("rootid") %>,<% =pageno %>)</script>
<%
rowcount=rowcount-1
guestrs.movenext
if not guestrs.eof then
  if guestrs("rootid")<>0 and rowcount=0 then rowcount=1
end if
loop
guestrs.close
set guestrs=nothing
guestconn.close
set guestconn=nothing
%>
</table>
</form>
<br><br><br>
</body>
</html>
上一篇:用排序串字段实现树状结构(例程——显示贴子内容) 人气:11052
下一篇:用排序串字段实现树状结构(存储过程) 人气:12629
浏览全部用排序串字段实现树状结构的内容 Dreamweaver插件下载 网页广告代码 祝你圣诞节快乐 2009年新年快乐