网络编程
位置:首页>> 网络编程>> Asp编程>> 动态载入asp树源码(2)

动态载入asp树源码(2)

  发布时间:2007-09-06 19:34:00 

标签:asp,树

页面 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; 
}



 

0
投稿

猜你喜欢

手机版 网络编程 asp之家 www.aspxhome.com