An ASP-written side menu bar

Source: Internet
Author: User
Tags chr
Menu | Menu Demo: http://goaler.xicp.net/demo/colspanmenu.asp

<%
Class Menus

Public Title, ID, Image, Titlecolor, Target, Background, Headimage, Height, Width, bgcolor, Style
Private MenuItem, Menustr

Private Sub Class_Initialize
Title = ""
ID = ""
MenuItem = ""
Image= ""
Titlecolor = "#000000"
Target = "_blank"
Background = ""
Headimage = ""
Height = "20"
Width = "100%"
bgcolor = ""
Style = ""
Script
End Sub

Private Sub Class_Terminate
Title = ""
ID = ""
MenuItem = ""
End Sub

Public Function AddItem (Byval nitem, Byval nurl)
MenuItem = MenuItem & "<tr><td style= ' font-size:12px; ' align= ' left ' > {$Image}<a href= '" & Nurl & Amp "' target= '" &Target& "' class= '" & Style & "' >" & nitem & "</a></td></tr>"
End Function

Public Sub Show ()
Menustr = "<table border=0 width= '" & Width & "' style= ' border:1px solid #999999; ' bgcolor= '" & BgColor & " ' ><tr><td height= ' & Height & ' Onclick=menus (' & ID & ') bgcolor= ' & bgcolor & ' VA lign= ' bottom ' style= ' "& _
"Font-size:12px;color:" &TitleColor& "Cursor:hand; ' background= '" &Background& "' align= ' left ' > { $HeadImage} "& Title & </td></tr></table><div id=" & Chr (+) & ID & CHR ; "Style=" &AMP;CHR & _
"Display:none;" & Chr & "><table width=100% border=0 style= ' border-left:1px solid #999999; border-right:1px Solid 999999;border-bottom:1px solid #999999; ' > "& MenuItem &" </table></div> "

If image<> "" Then
MENUSTR = replace (Menustr, "{$Image}", Image)
Else
MENUSTR = replace (Menustr, "{$Image}", "")
End If

If headimage<> "" Then
MENUSTR = replace (Menustr, "{$HeadImage}", Headimage)
Else
MENUSTR = replace (Menustr, "{$HeadImage}", "")
End If

Response.Write Menustr
End Sub

Private Function Script ()
Dim JScript

JScript = "<script language=" &AMP;CHR & "JavaScript" &AMP;CHR (a) & "Type=" &AMP;CHR (+) & "text/ JavaScript "&AMP;CHR" (& _)
">" &vbcrlf& "<!--" &vbcrlf& "function menus (str) {" &vbcrlf& "var obj;if ( document.getElementById (str)) {"&vbcrlf& _
"Obj=document.getelementbyid (str);" & _
"If" (Obj.style.display = &AMP;CHR () & "None" &chr (+) & ") {Obj.style.display = &AMP;CHR (34) & _
";} Else{obj.style.display = "&AMP;CHR" & "None" &chr (+) & ";}}} --></script> "

Response. Write JScript
End Function

Public Sub AddNew ()
Title = ""
ID = ""
MenuItem = ""
Menustr = ""
End Sub

Public Sub Openitem (Byval ItemID)

End Sub

End Class
%>

How to use:
<%
Dim Newmenus
Set Newmenus = new Menus
Newmenus.target = "' Open mode
Newmenus.bgcolor = "#336699" main label background color
Newmenus.titlecolor = "#FFFFFF" main label font color
Newmenus.height = "10px" ' Height
Newmenus.style = "A1" ' Sub-label style
Newmenus.width = "100%" ' Menu width

Newmenus.addnew
Newmenus.title = "portal Site"
Newmenus.id = "Menu1"
Newmenus.additem "NetEase", "http://www.163.com"
Newmenus.additem "Sohu", "http://www.sohu.com"
Newmenus.show

Newmenus.addnew
Newmenus.title = "Personal Site"
Newmenus.id = "MENU2"
Newmenus.additem "Iebsoft Studio", "http://iebsoft.512j.com"
Newmenus.additem "Rented space", "http://107814.hxidc.com"
Newmenus.show

Newmenus.addnew
Newmenus.title = "Website News Management"
Newmenus.id = "Menu3"
Newmenus.additem



Related Article

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.