ASP tree menu

Source: Internet
Author: User

Assume that the menu page is left. asp, and the product page is product. asp.

The source code of left. asp is as follows:

<Table width = "100%" border = "0" cellspacing = "0" cellpadding = "0">
<%
SQL = "select * From class1 order by class1id ASC" 'read category
Set sortrootrs=conn.exe cute (SQL)
I = 0
Do while not (sortrootrs. EOF or ERR)
Sortrootrsid = sortrootrs ("class1id ")
%>
<Tr>
<TD Height = "18" align = "Left" valign = "TOP" background = "images/pole_1.jpg"> <Div style = "padding-left: 12px; padding-top: 0px ">
<A href = "products. asp? Class1id = <% = sortrootrs ("class1id") %> "> <SPAN class =" style6 "> <% = sortrootrs (" class1name ") %> </span> </a> 'displays the category list.
</Div> </TD>
</Tr>
<Tr id = Child <% = sortrootrsid %> style = 'display: none'> 'use styles to control the category list. It is not displayed by default.
<TD Height = "18" align = "Left" valign = "TOP" background = "images/pole_2.jpg">
<%
SQL = "select * From class2 where class1id =" & sortrootrs ("class1id") & "order by class2id ASC" 'read small class
Set sortchildrs = server. Createobject ("ADODB. recordset ")
Sortchildrs. Open SQL, Conn, 1, 1
J = 1
'K = sortchildrs. recordcount
Do while not (sortchildrs. EOF or ERR)
%>
<Div style = "padding-left: 12px; padding-top: 0px; line-Height: 18px;">
<A href = "products. asp? Class1id = <% = sortrootrs ("class1id") %> & class2id = <% = sortchildrs ("class2id") %> "class =" style7 "style =" text-Decoration: none "> <% = sortchildrs (" class2name ") %> </a>
</Div>
<% J = J + 1
'If j> 100 then exit do
Sortchildrs. movenext
Loop %> 'small Loop
</TD>
</Tr>
<%
I = I + 1
If I> 100 then exit do
Sortrootrs. movenext
Loop
%> 'Large class Loop
</Table>

Product. asp

<Script language = JavaScript>
<! --
Function window_onload (I ){
Childsort = Document. All ("child" + I );
// Thetd = Document. All ("TD" + I );
If (childsort. style. Display = "NONE "){
// Thetd. bgcolor = "# ffffff ";
Childsort. style. Display = "";}
Else {
// Thetd. bgcolor = "#000000 ";
Childsort. style. Display = "NONE ";}
}

// -->
</SCRIPT>

<HTML>
<Body onload = "window_onload (<% = class1id %>)">
<! -- # Include file = "left. asp" -->
</Body>
</Html>

 

If you think the above content is helpful to you, please support the following link: http: // www.lvyedianzi.com

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.