http://uheart.myetang.com/treeproblem.rar为完整的文件包,里有数据库,IIS直接运行里面的页面文件就行了
解决方案 »
- js正则表达式问题。求解
- 问1个js提交表单获取值的问题,100%结贴率
- JS视频第5讲 JavaScript自己定义函数和系统函数的应用
- netmeeting嵌入到网页后如何通过代码实现原netmeeting中“自动接收呼叫”功能?
- JavaScript正则表达式是“/^fffff&/”还是new RegExp("/^fffff&/")
- 如何获取指定单元格的值
- 隐藏表格的行,这样的语句实现不了,请教如何实现??
- 怎么用javascript来判断用户名和密码同时为空
- 求助关于html编辑器的问题! 特急!在线等待!
- javascript有没有类似ontime事件?(如果没有的话怎么实现这中功能?)
- 请教高手!!(急急)通过javascript能够得到html中的页面的链接地址吗?在线苦等
- 在Javascript中有什么函数的功能等同于vbscript的Mid函数功能?本人对Mid函数功能也不了解!
<%
Function GetConn
'On Error Resume Next
'Dim Conn
'Set Conn = Server.CreateObject("ADODB.Connection")
'Conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("teacher.MDB")
'Conn.Open
Set GetConn = Conn
End FunctionFunction WriteTree(ParentID,Prefix)
Dim Rs, ThisID, SQL, ImgPath, ImgPath2, ImgPath3, HasSubItem, IsEnd, ThisPrefix
Set Rs = Server.CreateObject("ADODB.RecordSet")
SQL = "Select * From tbl_Tree Where I_Rank=" & ParentID
Rs.Open SQL, GetConn, 1
For i = 1 To Rs.RecordCount
HasSubItem = GetConn.Execute("Select Count(*) From tbl_Tree Where I_Rank=" & Rs("I_RecordID"))(0)
If i = Rs.RecordCount Then '最后一个节点
If HasSubItem > 0 Then '有子节点
ImgPath = "Lessons/TreeImages/Line_plastnode.gif"
ImgPath2 = "Lessons/TreeImages/Line_mlastnode.gif"
ImgPath3 = "Lessons/TreeImages/OpenediDefFolder.gif"
Else '没有子节点
ImgPath = "Lessons/TreeImages/Line_lastnode.gif"
ImgPath2 = "Lessons/TreeImages/Line_lastnode.gif"
ImgPath3 = "Lessons/TreeImages/iText.gif"
End If
IsEnd = True
Else '非最后一个节点
If HasSubItem > 0 Then '有子节点
ImgPath = "Lessons/TreeImages/Line_pnode.gif"
ImgPath2 = "Lessons/TreeImages/Line_mnode.gif"
ImgPath3 = "Lessons/TreeImages/OpenediDefFolder.gif"
Else '没有子节点
ImgPath = "Lessons/TreeImages/Line_node.gif"
ImgPath2 = "Lessons/TreeImages/Line_node.gif"
ImgPath3 = "Lessons/TreeImages/iText.gif"
End If
IsEnd = False
End If
If Prefix = "" And i = 1 Then ImgPath = "Lessons/TreeImages/School.gif" '第一个节点使用特殊图标
If IsEnd Then '最后一个节点
ThisPrefix = Prefix & "<img height=16 width=16 src=""Lessons/TreeImages/Node_blank.gif"">"
Else '非最后一个节点
ThisPrefix = Prefix & "<img height=16 width=16 src=""Lessons/TreeImages/Line_vertline.gif"">"
End If
If HasSubItem > 0 Then '有子节点
If Rs("B_Link") Then '有链接
Response.Write Prefix & "<span style=""cursor:hand;""><img src=""" & ImgPath & """><img src=""" & ImgPath2 & """ style=""display:none""><img height=16 width=16 src=""" & ImgPath3 & """><a href=""" & Rs("C_Link") & """><span style=""border:#FFFFFF 1 solid;"" onmouseover=""this.style.backgroundColor='#DDDDDD';this.style.borderColor='#999999';"" onmouseout=""this.style.backgroundColor='';this.style.borderColor='#FFFFFF';"">" & Rs("C_Title") & "</span></a></span><br>"
Else '没有链接
Response.Write Prefix & "<span style=""cursor:hand;"" onclick=""clickItem(this);""><img src=""" & ImgPath & """><img src=""" & ImgPath2 & """ style=""display:none""><img height=16 width=16 src=""" & ImgPath3 & """><span style=""border:#FFFFFF 1 solid;"" onmouseover=""this.style.backgroundColor='#DDDDDD';this.style.borderColor='#999999';"" onmouseout=""this.style.backgroundColor='';this.style.borderColor='#FFFFFF';"">" & Rs("C_Title") & "</span></span><br>"
End If
Response.Write "<span style=""display:none;"">"
Call WriteTree(Rs("I_RecordID"),ThisPrefix) '递归调用
Response.Write "</span>"
Else '没有子节点
If Rs("B_Link") Then '有链接
Response.Write Prefix & "<span style=""cursor:hand;""><img height=16 src=""" & ImgPath & """><img src=""" & ImgPath2 & """ style=""display:none""><img height=16 width=16 src=""" & ImgPath3 & """><a href=""" & Rs("C_Link") & """><span style=""border:#FFFFFF 1 solid;"" onmouseover=""this.style.backgroundColor='#DDDDDD';this.style.borderColor='#999999';"" onmouseout=""this.style.backgroundColor='';this.style.borderColor='#FFFFFF';"">" & Rs("C_Title") & "</span></a></span><br>"
Else '没有链接
Response.Write Prefix & "<span style=""cursor:hand;""><img height=16 src=""" & ImgPath & """><img src=""" & ImgPath2 & """ style=""display:none""><img height=16 width=16 src=""" & ImgPath3 & """><span style=""border:#FFFFFF 1 solid;"" onmouseover=""this.style.backgroundColor='#DDDDDD';this.style.borderColor='#999999';"" onmouseout=""this.style.backgroundColor='';this.style.borderColor='#FFFFFF';"">" & Rs("C_Title") & "</span></span><br>"
End If
End If
Rs.MoveNext
Next
End Function
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>TreeMenu Test</TITLE>
<base href="http://hyg:88/Test/treeproblem/">
<META NAME="Generator" CONTENT="EditPlus">
<script language="JavaScript">
function clickItem(obj)
{
var srcobj = obj.nextSibling.nextSibling;
if(srcobj.style.display == "none")
{
srcobj.style.display = "";
}
else
{
srcobj.style.display = "none";
}
if(obj.children[0].style.display == "none")
{
obj.children[0].style.display = "";
obj.children[1].style.display = "none";
}
else
{
obj.children[0].style.display = "none";
obj.children[1].style.display = "";
}
}
</script>
</HEAD><BODY>
<%Call WriteTree(0,"")%>
</BODY>
</HTML>