使用ASP實(shí)現(xiàn)網(wǎng)站的“目錄樹(shù)”管理的代碼
數(shù)據(jù)庫(kù)結(jié)構(gòu)(共使用了兩個(gè)表)
1。tblCategory
字段名 類型
Root binary 說(shuō)明樹(shù)關(guān)或開(kāi)(目錄的根)
ID 自動(dòng)編號(hào) 關(guān)鍵字
Sort integer 識(shí)別該字段內(nèi)容的整數(shù)(如果root是開(kāi)狀態(tài)sort為0)表示顯示的目錄的順序
Name text(255)可以包含html中的標(biāo)識(shí)符
HREF text(255) 允許空
2。tblPages
ID 自動(dòng)編號(hào)
Sort integer 關(guān)鍵字
Name text(255)
HREF text(255)
3.default.htm
<html>
<head>
<title>javascript Tree Control Template</title>
</head>
<frameset cols=""210,*"">
?<frame src=""tree.asp"" name=""TOC"">
?<frame src=""main.htm"" name=""basefrm"">
</frameset>
</html>
4.main.htm
<head><title></title></head>
<body>
<h2>Start Page</h2>
</body>
</html>
5.tree.asp
Set conn = Server.CreateObject(""ADODB.Connection"")
Set Rs = Server.CreateObject(""ADODB.Recordset"")
conn.open ""DRIVER=Microsoft Access Driver (*.mdb);DBQ="" & Server.MapPath(""toc.mdb"")
strsql = ""SELECT tblCategory.Root, tblCategory.[ID], tblCategory.Sort AS CatSort, tblPages.sort AS LinkSort, tblCategory.[Name] AS CatName, tblCategory.HREF AS CatURL, tblPages.[Name] AS LinkName, tblPages.href AS LinkURL FROM tblCategory LEFT JOIN tblPages ON tblCategory.[ID] = tblPages.[ID] ORDER BY tblCategory.root ASC, tblCategory.Sort, tblPages.sort""
rs.open strsql, conn, 2, 2
if not rs.eof then rs.movefirst
currentID = """" %>
<html>
<head>
<link rel=""stylesheet"" href=""ftie4style.css"">
<!-- Infrastructure code for the tree -->
<script src=""ftiens4.js""></script>
<!-- Execution of the code that actually builds the specific tree -->
<script>
USETEXTLINKS = 1
<%
Do While Not Rs.EOF
If Rs(""Root"") = True Then %>
foldersTree = gFld(""<%= Rs(""CatName"") %>"", ""<%= Rs(""CatURL"") %>"")
<% Else %>
aux1 = insFld(foldersTree, gFld(""<%= Rs(""CatName"") %>"", ""<%= Rs(""CatURL"") %>""))
<% currentID = Rs(""ID"")
savedID = Rs(""ID"")
Do While currentID = savedID and not rs.eof
if Rs(""LinkName"") <> """" Then %>
insDoc(aux1, gLnk(0, ""<%= Rs(""LinkName"") %>"", ""<%= Rs(""LinkURL"") %>""))
<%
end if
Rs.MoveNext
if not rs.eof then currentID = Rs(""ID"")
Loop
End If
if currentID = """" then rs.movenext
Loop %>
</script>
<script>
initializeDocument()
</script>
<base target=""basefrm"">
<title></title>
</head>
<body bgcolor=""white"">
</body>
</html>
相關(guān)文章
ASP獲取網(wǎng)頁(yè)全部圖片地址并保存為數(shù)組的正則
ASP常用函數(shù):getIMG()獲取網(wǎng)頁(yè)全部圖片地址并保存為數(shù)組2008-03-03ASP基礎(chǔ)入門(mén)第四篇(腳本變量、函數(shù)、過(guò)程和條件語(yǔ)句)
大家在學(xué)習(xí)了腳本語(yǔ)言 VBScript 的變量、常量和過(guò)程的基本概念后,本期將繼續(xù)向各位介紹 VBScript 的函數(shù)和語(yǔ)法。2015-10-10P3P 和 跨域 (cross-domain) cookie 訪問(wèn)(讀取和設(shè)置)
在IE 里面跨域去設(shè)置 cookie跨域的實(shí)現(xiàn),嘗試了n中方法都不行,查了一下資料,可以通過(guò)設(shè)置header中的p3p值來(lái)實(shí)現(xiàn),真不錯(cuò):)2009-06-06Access數(shù)據(jù)庫(kù)中“所有記錄中均未找到搜索關(guān)鍵字”的解決方法
這個(gè)是Access一個(gè)天生不足的表現(xiàn),出現(xiàn)此錯(cuò)誤是因?yàn)槟愕腁ccess數(shù)據(jù)庫(kù)有錯(cuò)誤了。2008-08-08SQL查詢語(yǔ)句通配符與ACCESS模糊查詢like的解決方法
我今天在寫(xiě)個(gè)頁(yè)面的時(shí)候,也很郁悶,表中明明有記錄,但在ASP里就是搜索不到,原來(lái)是因?yàn)閍ccess與SQL的查詢語(yǔ)句通配符問(wèn)題不同所引起的。2011-02-02ASP運(yùn)行出錯(cuò):缺少對(duì)象: ''xmlDoc.documentElement''錯(cuò)誤解決方法
ASP運(yùn)行出錯(cuò):缺少對(duì)象: 'xmlDoc.documentElement'錯(cuò)誤解決方法,需要的朋友可以參考下2012-03-03自己寫(xiě)的文件操作的function和Sub vb.net dll
自己寫(xiě)的文件操作的function和Sub vb.net dll...2007-08-08