Tree-like menu (JS Version)

Source: Internet
Author: User

<! 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 = "Flying Fish">
<Meta name = "keywords" content = "Feiyu">
<Meta name = "Description" content = "tree menu">
<Style type = "text/CSS">
* {Font-size: 12px ;}
</Style>
</Head>

<Body>
<SCRIPT>

VaR request =
{
Querystring: New thunderbirdrequestquerystring (),
Cookies: New thunderbirdrequestcookies ()
}
Function thunderbirdrequestquerystring ()
{
This. Current = Document. Location. search;
This. Count = 0;
This. Item = new array ();
This. Item = function (strkey)
{
If (typeof (this. item [strkey])! = "Undefined ")
{
Return this. item [strkey];
}
Else
{
Return "";
}
}
Thunderbirdrequestoninit (/([^? &] [A-z/d] *) = ([^ # &] *)/Gim, this. Current, this. Count, this. item );
}
Function thunderbirdrequestcookies ()
{
This. Current = Document. Cookie;
This. Count = 0;
This. Item = new array ();
This. Item = function (strkey)
{
If (typeof (this. item [strkey])! = "Undefined ")
{
Return this. item [strkey];
}
Else
{
Return "";
}
}
Thunderbirdrequestoninit (/([^? &] [A-z/d] *) = ([^ # &;] *)/Gim, this. Current, this. Count, this. item );
}
Function thunderbirdrequestoninit (regexprule, current, Count, item)
{
If (current! = "")
{
While (regexprule.exe C (current )! = NULL)
{
Item [Regexp. $1] = Regexp. $2;
Item [count] = Regexp. $2;
Count + = 1;
}
}
}
VaR conn = new activexobject ("ADODB. Connection ")
VaR connstr = "provider = Microsoft. Jet. oledb.4.0; Data Source = test. mdb"
Try
{
Conn. Open (connstr)
}
Catch (E)
{
VaR cat = new activexobject ("ADOX. catalog ")
VaR catstr = "provider = Microsoft. Jet. oledb.4.0; Data Source = test. mdb"
Cat. Create (catstr)
Cat = NULL;
VaR conn = new activexobject ("ADODB. Connection ")
VaR connstr = "provider = Microsoft. Jet. oledb.4.0; Data Source = test. mdb"
Conn. Open (connstr)
Conn.exe cute ("create table test (ID int identity (250), Code varchar (250), title varchar (), info memo, type yesno default true, countnum int default 0) ")
Conn.exe cute ("insert into test (Code, title, Info) values ('20140901', 'asp ','')")
Conn.exe cute ("insert into test (Code, title, info, type, countnum) values ('20170101', 'asp1','', false, 3 )")
Conn.exe cute ("insert into test (Code, title, Info) values ('20140901', 'asp2 ','')")
Conn.exe cute ("insert into test (Code, title, Info) values ('20170101', 'asp21 ','')")
Conn.exe cute ("insert into test (Code, title, Info) values ('20140901', 'asp22 ','')")
Conn.exe cute ("insert into test (Code, title, Info) values ('20140901', 'xml ','')")
Conn.exe cute ("insert into test (Code, title, info, type, countnum) values ('000000', 'xml1','', false, 20 )")
Conn.exe cute ("insert into test (Code, title, Info) values ('20140901', 'xml2 ','')")
Conn.exe cute ("insert into test (Code, title, Info) values ('20140901', 'xml21 ','')")
Conn.exe cute ("insert into test (Code, title, Info) values ('20140901', 'xml3 ','')")
}

/* Rsw.conn.exe cute ("select ID, username, userpwd from test ")
Ary_rs = new vbarray (Rs. getrows ())
Alert (ary_rs.getitem (1, 1 ))
*/
Id = request. querystring. item ["classid"]
If (typeof (ID )! = "Undefined "){
Column#conn.exe cute ("Select Code from test where id =" + id );
If (! Column. EOF) {columncode = column (0) + "";
}
Else {
Id = 1;
Columncode = "0001 ";
}
}
Else
{
Id = 1;
Columncode = "0001 ";
}
Document. Write (sitecolumnnav (ID, columncode ))
Function sitecolumnnav (columnid, columncode)
{Var temparray, tempstr
VaR I, steplen, sourcode

Sourcode = columncode. substr (0, 4)
SQL = "select [ID], code, title, info, [type], countnum from [test] Where left (Code, 4) like '"+ sourcode +"' or Len (CODE) = 4 order by code"
Rs = conn. Execute (SQL)
Conn = NULL;
Tempstr = "<Table border =/" 0/"cellpadding =/" 0/"cellspacing =/" 0/"align =/" center/"width =/" 98% /" >"
If (! (Rs. EOF | Rs. bof )){
Temparray = new vbarray (Rs. getrows ())

For (I = 0; I <temparray. ubound (2) + 1; I ++ ){
Steplen = (temparray. getitem (1, I). Length/4) * 2-2

Tempstr + = "<tr> <TD align =/" Left/"Height =/" 22/">"
If (temparray. getitem (1, I). length> 4 ){
Tempstr + = "batch"
Tempstr + = string (steplen ,"-")
}
If (parsefloat (temparray. getitem (0, I) = parsefloat (columnid )){
Tempstr + = "}
Else
{
Tempstr + = "}

If (! Temparray. getitem (4, I) tempstr + = "[subject]"
Tempstr + = "<a href = /"? Classid = "+ temparray. getitem (0, I) +"/">" + temparray. getitem (2, I)
Tempstr + = "</a> <font color = aaaaaa> (" + temparray. getitem (5, I) + ") </font>"
Tempstr + = "</TD>"
Tempstr + = "</tr>"
}
}
Tempstr + = "</table>"

Return tempstr
}
Function string (L, STR)
{
For (var k = 0, TMP = ""; k <L; k ++) {TMP + = STR}
Return TMP;
}
</SCRIPT>

</Body>
</Html>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.