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