1.建立一個(gè)aspx頁(yè)面 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 ) // 分類(lèi)已下載 { 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 ) // 葉子節(jié)點(diǎn) { 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 = " 展開(kāi)/折疊 " ; 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 ); } // 葉子節(jié)點(diǎn)的單擊響應(yīng)函數(shù) function OpenDocument(iCategoryID) { // 預(yù)加載信息 PreloadFormUrl(iCategoryID); } function PreviewImage(iCategoryID) { } function ChangeStatus(iCategoryID) { var li_father = el( " li_ " + iCategoryID); if (li_father.className == " Closed " ) { li_father.className = " Opened " ; } else { li_father.className = " Closed " ; } } function switchNote(iCategoryID,show) { var li_father = el( " li_ " + iCategoryID); if (show) { var ul = document.createElement( " ul " ); ul.id = " ul_note_ " + iCategoryID; var note = document.createElement( " li " ); note.className = " Child " ; var img = document.createElement( " img " ); img.className = " s " ; img.src = " ../../Styles/tree_css/s.gif " ; var a = document.createElement( " a " ); a.href = " javascript:void(0); " ; a.innerHTML = " 請(qǐng)稍候 " ; note.appendChild(img); note.appendChild(a); ul.appendChild(note); li_father.appendChild(ul); } else { var ul = el( " ul_note_ " + iCategoryID); if (ul) { li_father.removeChild(ul); } } } // 加載根節(jié)點(diǎn) var tree = el( " CategoryTree " ); var root color: #000000; backgroun 分享到: Ajax實(shí)現(xiàn)在textbox中輸入內(nèi)容,動(dòng)態(tài)從數(shù)據(jù) ... | Ajax無(wú)刷新實(shí)現(xiàn)圖片切換特效 2007-03-19 22:57 瀏覽 184 評(píng)論(0) 相關(guān)推薦 評(píng)論 發(fā)表評(píng)論 您還沒(méi)有登錄,請(qǐng)您登錄后再發(fā)表評(píng)論 Ajax實(shí)現(xiàn)無(wú)刷新樹(shù) 更多文章、技術(shù)交流、商務(wù)合作、聯(lián)系博主 微信掃碼或搜索:z360901061 微信掃一掃加我為好友 QQ號(hào)聯(lián)系: 360901061 您的支持是博主寫(xiě)作最大的動(dòng)力,如果您喜歡我的文章,感覺(jué)我的文章對(duì)您有幫助,請(qǐng)用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點(diǎn)擊下面給點(diǎn)支持吧,站長(zhǎng)非常感激您!手機(jī)微信長(zhǎng)按不能支付解決辦法:請(qǐng)將微信支付二維碼保存到相冊(cè),切換到微信,然后點(diǎn)擊微信右上角掃一掃功能,選擇支付二維碼完成支付。 【本文對(duì)您有幫助就好】元 2元 5元 10元 20元 自定義 喜歡作者