Ajax实现无刷新树1
点击次数:24 次 发布日期:2008-11-26 11:06:09 作者:源代码网
|
源代码网推荐 html代码 源代码网推荐 <html xmlns="http://www.w3.org/1999/xhtml" > 源代码网推荐 <head id="Head1" runat="server"> 源代码网推荐 <title>小山</title> 源代码网推荐 <link type="text/CSS" href="../../Styles/tree_css/tree.css" rel="stylesheet"> 源代码网推荐 </head> 源代码网推荐 <body> 源代码网推荐 <form id="Form1" runat="server"> 源代码网推荐 <table width=100% cellpadding=0 cellspacing=0 border=0> 源代码网推荐 <colgroup> 源代码网推荐 <col width=180 /> 源代码网推荐 <col /> 源代码网推荐 </colgroup> 源代码网推荐 <tr> 源代码网推荐 <td> 源代码网推荐 <div class="TreeMenu" id="CategoryTree" style="width: 100%; height: 489px"> 源代码网推荐 </div> 源代码网推荐 </td> 源代码网推荐 <td> 源代码网推荐 <iframe id=furl height=20 style="height: 497px; width: 100%;"></iframe> 源代码网推荐 </td> 源代码网推荐 </tr> 源代码网推荐 </table> 源代码网推荐 源代码网推荐 <script language="jscript"> 源代码网推荐 function el(id) 源代码网推荐 { 源代码网推荐 return document.getElementById(id); 源代码网推荐 } 源代码网推荐 function ExpandSubCategory(iCategoryID) 源代码网推荐 { 源代码网推荐 var li_father = el("li_" + iCategoryID); 源代码网推荐 if (li_father.getElementsByTagName("li").length > 0) //分类已下载 源代码网推荐 { 源代码网推荐 ChangeStatus(iCategoryID); 源代码网推荐 return; 源代码网推荐 } 源代码网推荐 源代码网推荐 li_father.className = "Opened"; 源代码网推荐 源代码网推荐 switchNote(iCategoryID, true); 源代码网推荐 AjaxMethod.GetSubCategory(iCategoryID, GetSubCategory_callback); 源代码网推荐 } 源代码网推荐 源代码网推荐 function GetSubCategory_callback(response) 源代码网推荐 { 源代码网推荐 var dt = response.value.Tables[0]; 源代码网推荐 if (dt.Rows.length > 0) 源代码网推荐 { 源代码网推荐 var iCategoryID = dt.Rows[0].FatherID; 源代码网推荐 } 源代码网推荐 var li_father = el("li_" + iCategoryID); 源代码网推荐 var ul = document.createElement("ul"); 源代码网推荐 for (var i = 0;i < dt.Rows.length;i++) 源代码网推荐 { 源代码网推荐 if (dt.Rows[i].IsChild == 1) //叶子节点 源代码网推荐 { 源代码网推荐 var li = document.createElement("li"); 源代码网推荐 li.className = "Child"; 源代码网推荐 li.id = "li_" + dt.Rows[i].CategoryID; 源代码网推荐 源代码网推荐 var img = document.createElement("img"); 源代码网推荐 img.id = dt.Rows[i].CategoryID; 源代码网推荐 img.className = "s"; 源代码网推荐 img.src = "../../Styles/tree_css/s.gif"; 源代码网推荐 源代码网推荐 var a = document.createElement("a"); 源代码网推荐 var id = dt.Rows[i].CategoryID; 源代码网推荐 a.onmouseover = function() 源代码网推荐 { 源代码网推荐 PreviewImage(id); 源代码网推荐 }; 源代码网推荐 a.href = "javascript:OpenDocument("" + dt.Rows[i].CategoryID + "");"; 源代码网推荐 a.innerHTML = dt.Rows[i].CategoryName; 源代码网推荐 } 源代码网推荐 else 源代码网推荐 { 源代码网推荐 var li = document.createElement("li"); 源代码网推荐 li.className = "Closed"; 源代码网推荐 li.id = "li_" + dt.Rows[i].CategoryID; 源代码网推荐 源代码网推荐 var img = document.createElement("img"); 源代码网推荐 img.id = dt.Rows[i].CategoryID; 源代码网推荐 img.className = "s"; 源代码网推荐 img.src = "../../Styles/tree_css/s.gif"; 源代码网推荐 img.onclick = function () { 源代码网推荐 ExpandSubCategory(this.id); 源代码网推荐 }; 源代码网推荐 img.alt = "展开/折叠"; 源代码网推荐 源代码网推荐 var a = document.createElement("a"); 源代码网推荐 a.href = "javascript:ExpandSubCategory(" + 源代码网推荐 dt.Rows[i].CategoryID + ");"; 源代码网推荐 a.innerHTML = dt.Rows[i].CategoryName; 源代码网推荐 } 源代码网推荐 li.appendChild(img); 源代码网推荐 li.appendChild(a); 源代码网推荐 ul.appendChild(li); 源代码网推荐 } 源代码网推荐 li_father.appendChild(ul); 源代码网推荐 源代码网推荐 switchNote(iCategoryID, false); 源代码网推荐 } 源代码网推荐 源代码网推荐 // 叶子节点的单击响应函数 源代码网推荐 function OpenDocument(iCategoryID) 源代码网推荐 { 源代码网推荐 // 预加载信息 源代码网推荐 PreloadFormUrl(iCategoryID); 源代码网推荐 } 源代码网推荐 源代码网推荐 function PreviewImage(iCategoryID) 源代码网推荐 { 源代码网推荐 源代码网推荐 } 源代码网推荐 源代码网推荐 源代码网推荐 做人要厚道,请注明转自酷网动力(www.ASPCOOL.COM)。 源代码网推荐 源代码网供稿. |
