javascript|js| Navigation
<!--tree.jsp-->
<%@ page ContentType = "text/html;charset=gb2312"%>
<%@ page import= "java.util.*;"%>
<! DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 transitional//en" >
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<meta name= "generator" content= "EditPlus" >
<meta name= "Author" content= "" >
<meta name= "Keywords" content= "" >
<meta name= "Description" content= "" >
</HEAD>
<BODY>
<iframe width= "100%" height= "id=" "Hiddenframe" ></iframe>
<script>
function Expandnode (Parentnode,parentid) {
var nodex = eval (parentnode.id + ' _0 ');
if (NodeX.style.display = = ' None ')
{
nodex.style.display= "Block";
if (nodex.loaded = = ' no ')
{
document.frames[' Hiddenframe '].location.replace ("subtree.jsp?") Pid= "+ ParentID +" &pnode= "+ parentnode.id);
nodex.loaded = ' yes ';
}
}
Else
{
Nodex.style.display= ' None ';
}
}
</script>
<CENTER>
<table border= "1" width= "20%" height= "60%" >
<TR>
<TD>
<div style= "Overflow:auto; width:100%; height:100% ">
<table width= "300%" >
<TR>
<TD>
<%
Java.lang.Class.forName ("Sun.jdbc.odbc.JdbcOdbcDriver");
Java.sql.Connection Connectionx = java.sql.DriverManager.getConnection ("Jdbc:odbc:driver={microsoft Access driver (*.mdb)};D Bq=d:\\resin\\doc\\examples\\tree\\tree.mdb "," admin "," ");
Java.sql.Statement Statementx = Connectionx.createstatement ();
Java.sql.ResultSet resultsetx = java.sql.DriverManager.getConnection ("Jdbc:odbc:driver={microsoft Access driver (*. MDB)};D bq=e:\\resin-2.1.6\\doc\\examples\\tree\\tree.mdb "," admin "," ""). Createstatement (). ExecuteQuery ("SELECT *, (SELECT COUNT (*) from the tree where ParentID = t.id) as children from tree T where parentid = 0 ");
int i=0;
int children;
int ID;
while (Resultsetx.next ())
{
Children=resultsetx.getint ("Children");
Id=resultsetx.getint ("id");
%>
<div id= ' node_<%= i%> ' ><a href= ' # '
<% if (children >0)
{%>
<%}%>
>
<%=resultsetx.getstring ("remark")%></a>
</div>
<div id= ' node_<%= i%>_0 ' style= ' display:none ' loaded= ' no ' >
Loading ...
</div>
<%
i++;
}
%>
</BODY>
</HTML>
<!--subtree.jsp-->
<%@ page ContentType = "text/html;charset=gb2312"%>
<%@ page import= "java.util.*;"%>
<! DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 transitional//en" >
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<meta name= "generator" content= "EditPlus" >
<meta name= "Author" content= "" >
<meta name= "Keywords" content= "" >
<meta name= "Description" content= "" >
</HEAD>
<%
String parentnode = Request.getparameter ("Pnode");
int i;
Int J;
String nspace= "";
j= parentnode.length ()-Parentnode.replaceall ("_", ""). Length ();
for (i=0;i<j;i++)
Nspace = Nspace + "";
String SHTML = "";
i=0;
Java.lang.Class.forName ("Sun.jdbc.odbc.JdbcOdbcDriver");
Java.sql.Connection Connectionx = java.sql.DriverManager.getConnection ("Jdbc:odbc:driver={microsoft Access driver (*.mdb)};D Bq=d:\\resin\\doc\\examples\\tree\\tree.mdb "," admin "," ");
Java.sql.Statement Statementx = Connectionx.createstatement ();
Java.sql.ResultSet resultsetx = java.sql.DriverManager.getConnection ("Jdbc:odbc:driver={microsoft Access driver (*. MDB)};D bq=e:\\resin-2.1.6\\doc\\examples\\tree\\tree.mdb "," admin "," ""). Createstatement (). ExecuteQuery ("SELECT *, (SELECT COUNT (*) from the tree where ParentID =t.id) as Children from tree T where parentid = "+ Request.getparameter (" PID ") );
int children;
int ID;
while (Resultsetx.next ())
{Children=resultsetx.getint ("children");
Id=resultsetx.getint ("id");
SHTML = SHTML + "<div id= '" + parentnode + "_" + (i + 1) + "' >" + nspace + "<a href= '" ";
if (children >0)
SHTML = SHTML + "onclick=" Expandnode ("+ ParentNode +" _ "+ (i + 1) +", "+ ID +") ' >+ ';
else SHTML = SHTML + ">-";
SHTML = SHTML + "</a>\\n" + "<a href= '" ";
if (children >0)
SHTML = SHTML + "ondblclick=" Expandnode ("+ ParentNode +" _ "+ (i + 1) +", "+ ID +") ' ";
SHTML = SHTML + ">" + ID + ":" + resultsetx.getstring ("remark") + "</a></div>";
if (children >0)
SHTML = SHTML + "<div id= '" + parentnode + "_" + (i + 1) + "_0 ' style= ' display:none ' loaded= ' no ' >" + nspace + "is Load ...</div> ";
%>
<% i++;
}%>
<BODY>
<script>
var x = eval (' parent. ' + ' <%= parentnode + ' _0 '%> ');
X.innerhtml= "<%= SHTML%>";
</script>
</BODY>
</HTML>