动态载入asp树源码(2)
时间:2007-09-06 19:34:00
页面 subtree.asp
<%Option Explicit%>
<script language="JavaScript">
function NodeClass(id,Content,strLink,iChildren)
{
//this.id=parseInt(id);
this.id=id;
this.Content=Content;
this.strLink=strLink;
this.iChildren=iChildren;
//this.iChildren=parseInt(iChildren);
}
var ArrNode = new Array();
<%
Dim conn,rs,s,cls,href,Open
Dim nodeid,i
nodeid = Request.QueryString("id")
’On Error Resume Next
Set conn = Server.CreateObject("ADODB.Connection")
conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.mappath("tree/tree.mdb") & ";Persist Security Info=False"
Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open "select *,(select count(*) from deeptree where parentid = T.id) as children from deeptree T where parentid=" & nodeid & "",conn,1,3
i=0
Do While Not rs.EOF
%>
ArrNode[<%=i%>] = new NodeClass(<%=rs("id")%>,’<%=trim(rs("content"))%>’,’<%=trim(rs("link"))%>’,<%=rs("children")%>);
<%
i=i+1
rs.MoveNext
Loop
Set rs = Nothing
%>
parent.ArrToHtml(ArrNode,’<% = nodeid %>’);
-->
</script>
<%
Set conn = Nothing
%>
node.htc
<PUBLIC:COMPONENT>
<PUBLIC:ATTACH EVENT="onmouseover" ONEVENT="fos()"/>
<PUBLIC:ATTACH EVENT="onmouseout" ONEVENT="blu()"/>
<PUBLIC:ATTACH EVENT="onselectstart" ONEVENT="st()"/>
<SCRIPT>
function fos(){
if(style.backgroundColor!=’#ffffff’){
style.color="#000000"
style.border="1 solid #888888"
style.backgroundColor=’#DDDDDD’
}
else
{style.color="#000000"
style.border="1 solid #999999"
style.backgroundColor=’#ffffff’
}
}
function blu(){
if(style.backgroundColor!=’#ffffff’){
style.color="#000000"
style.border="1 solid #f2f2f2"
style.backgroundColor=’#f2f2f2’
}
else
{style.color="#000000"
style.border="1 solid #999999"
style.backgroundColor=’#ffffff’
}
}
function st(){
return false;
}
</SCRIPT>
</PUBLIC:COMPONENT>
样式页面 style.css
body{font-size:12px}
#txt{font-size: 12px; color: #000000; font-family: Courier New;border:1 solid #3366cc}
#hrf{font-size: 12px; color: #000000; font-family: Courier New;border:1 solid #3366cc}
#sb{font-size: 12px; color: #000000; font-family: Courier New;background-color:#d2e8ff;border:1 solid #3366cc;cursor:hand}
.node{position:relative;left:2;height:20;padding:3 3 1 3;font-size:12px;font-family: Courier New;cursor:hand;border:1 solid #f2f2f2;behavior:url(css/node.htc)}
.load{position:relative;left:2;height:20;padding:1 3 1 3;font-size:12px;font-family: Courier New;cursor:hand;border:1 solid #999999;background-color:#f2f2f2;color:#999999}
.td_node{height:22px}
#treedir{
}
span.diropen
{ padding-left:2px;
overflow:hidden;
line-height:3px;
font-size:12px;
padding-top:5px;
width:11px;
height:11px;
border:solid 1px black;
background-color:#ffffff;
cursor:hand;
}
span.dirclose
{
line-height:6px;
font-size:9px;
overflow:hidden;
padding:2px;
width:11px;
height:11px;
border:solid 1px black;
background-color:#ffffff;
cursor:hand;
}
.dirNode
{
font-weight:bold
overflow:visible;
font-size:9px;
line-height:3px;
padding: 1px 1px 0px 3px;
width:11px;
height:11px;
border:solid 1px black;
background-color:#ffffff;
cursor:hand;
}
标签:asp,树
0
投稿
猜你喜欢
扫盲大讲堂:mysql出错的代码解析及解答
2009-09-05 10:08:00
CSS Sprites对CSS布局的意义、优点和缺点介绍
2008-07-14 07:22:00
如何检测Oracle的ODBC是否连接成功?
2009-11-24 20:31:00
一个css垂直水平居中布局,css效果
2008-11-03 11:40:00
大家一起来折磨浏览器吧!(好玩的东东)
2010-02-07 12:40:00
网页中英文混排行高不等问题
2008-08-26 17:03:00
如何用表单在线建立目录?
2010-06-16 09:49:00
只有mdf文件的数据库附加失败的修复方法分享(置疑、只读)
2012-02-12 15:55:17
Bad Tags — html有害的标签
2008-10-13 19:47:00
web开发以HTML为中心
2008-02-13 08:14:00
基于鼠标点击跟踪的用户点击行为分析
2008-04-24 19:22:00
JavaScript缓动库
2009-05-25 12:50:00
asp之自动闭合HTML/ubb标签函数 附简单注释
2011-02-28 11:24:00
asp利用xmlhttp抓取特定网页内容例子
2008-10-10 12:58:00
现代 javscript 编程
2011-04-21 16:24:00
Javascript——浅析注册事件
2008-08-19 12:44:00
框架布局慎用元素
2008-12-21 16:33:00
盲人站长深恶痛绝的onfocus=”this.blur()”
2011-04-22 12:25:00
asp解决防止表单重复提交的方法
2007-10-19 18:40:00
FSO组件之文件操作(中)
2010-05-03 11:05:00