Using ASP and database to implement the pop-up menu with unlimited series
Source: Internet
Author: User
<!--#include virtual= ' include/database.asp '-->
<%
Set Rs=server.createobject ("ADODB. RecordSet ")
Sql= "Select Menu_name, Menu_link, Menu_bgcolor, menu_color,id from enter_individual WHERE (parent_id = (select IDs from ENT er_individual WHERE menu_flag = ' root ') "' Query gets root node
Rs. Open sql,conn,1,1
Response.Write "< table width=100% border=0 cellspacing=1 cellpadding=0 align=center>< tr bgcolor= #3399CC Valign=bottom align=center> "
Sumnum=rs. RecordCount
Myarray=rs. GetRows ()
Rs. Close ()
Widd=780/sumnum ' from the first Level submenu number to determine the pop-up menu x-coordinate increment pixel
Dim i
I=0
Defaultbgcolor= "#3399cc" ' specifies the default background color
Defaultcolor= ' #ffffff ' specifies the default font color
defaultlink= "#" to specify a default link
Posit_x=0 ' x position
Flag=1 ' flag, as menu pop-up direction 1 indicates right, 0 indicates left
' Response.Write MyArray (4,6)
While I Response.Write "< TD height=20 Bgcolor=" &myarray (2,i) & "Width=" &widd& ">< a href=" & MyArray (1,i) & "Onmouseover=java script:a" &myarray (4,i) & ". Style.display= ' block ' Onmouseout=java script: A "&myarray (4,i) &". style.display= ' None ' >< font color= "&myarray (3,i) &" > "&myarray (0,i) & "</a></td>"
'-----------------------------------------------
I=i+1
Wend
Response.Write "</tr></table>"
I=0
While I posit_y=100 ' y position back in place
If i>= (SUMNUM/2) Then ' If the menu goes to the right half, the pop-up turns
Flag=0
End If
' Call the GetSubMenu function to set the subordinate menu of the first-level menu to MyArray (4,i), which is the ID of the div that contains the subordinate menu.
GetSubMenu myarray (4,i), posit_x,posit_y
Posit_x=posit_x+widd ' The X coordinate value of the submenu of the next level menu is increased by one unit
I=i+1
Wend
' Functions to subordinate menus using a recursive algorithm
' parent_id parent ID; Posit_x the left position of the pop-up layer; Posit_y the ejection layer from the above position;
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.