To facilitate the use of categories, I defined a category table that includes the following fields: id (auto-number), cat_name (category name), parent_id (parent ID, corresponding to this table's ID), cat_order (order), is_show (whether to display), and u_id (this is used to differentiate between news categories, product categories, or other categories). For convenience, I placed all these categories in this single table. When adding categories for clients, the result was too many categories being displayed on the front-end, making it very long. The client provided feedback requesting that the subcategories only be displayed when clicking on the main category. Additionally, each category should have a dotted line underneath it, and there should be an image of a plus sign before the main category, which changes to a minus sign when expanded.
**Script function fd(id, Taohong Qingxue Pill, num):**
```javascript
t = $( "c" + id + "_1" ).style.display;
if(t == "none") {
t1 = "block";
t2 = "images/fll_34.gif";
} else {
t1 = "none";
t2 = "images/fll_34.gif";
}
```
This is ASP code for infinite-level category display, with IDs added to these categories:
```asp
If depath > 2 Then
display2 = "none"
Else
display2 = "block"
End If
Dim j
j = 1
Do While Not rs1.EOF
cat_name1 = rs1("cat_name")
cat_id1 = rs1("cat_id")
parent_id1 = rs1("parent_id")
'************** Below is what you want to display **************'
m9 = 0
sql2 = "select count(cat_id) as t from category where parent_id=" & cat_id1 & " and u_id=" & stype & ""
Set rs2 = Server.CreateObject("adodb.recordset")
Set rs2 = conn.Execute(sql2)
If Not rs2.EOF Then
m9 = rs2("t")
Else
m9 = 0
End If
rs2.Close
If (depath Mod 4 > 0) Then
mgif = "images/+.gif"
Else
mgif = "images/-.gif"
End If
If (depath = 4) Then
a = "block"
Else
a = "none"
End If
catstr = catstr & ""
If (m9 > 0) Then
catstr = catstr & "" & vbCrLf
Else
catstr = catstr & "" & vbCrLf
End If
For i = 1 To depath
catstr = catstr & " "
Next
catstr = catstr & cat_name1 & "" & vbCrLf
m9 = 0
sql2 = "select cat_name,cat_id from category where parent_id=" & parent_id1 & " and u_id=" & stype & " order by cat_order asc"
Set rs2 = Server.CreateObject("adodb.recordset")
Set rs2 = conn.Execute(sql2)
If Not rs2.EOF Then
depath = depath + 4
Call cat111(cat_id1, stype)
End If
rs2.Close
Set rs2 = Nothing
depath = depath - 4
'************** Above is what you want to display **************'
j = j + 1
rs1.MoveNext
Loop
End If
rs1.Close
Set rs1 = Nothing
End Function
```
Before using this function, initialize `catstr=""` and then call it. Add the dotted lines in the CSS class `dotted_class`. This way, everything is set up.
Note: Here, we get a row of a table that needs to be combined with other rows; don't add it inside a `` tag.
This article is organized and provided by Zhengzhou Website Construction -- Zhengzhou Website Construction (www.gjcyh.com).
Website keywords: Website Construction, Zhengzhou Website Construction, Zhengzhou Website Construction Company, Zhengzhou Website Creation, Zhengzhou Website Construction Phone Number, Zhengzhou Website Design, Zhengzhou Website Design Company, Zhengzhou Website Promotion, Zhengzhou Website Promotion Company, Zhengzhou Website Construction QQ, Zhengzhou Website Creation Company.
Related thematic articles: Detailed descriptions of product features, parameters, and usage instructions are also required. This kind of interaction is still quite basic.