一個ASP寫的側邊功能表列

來源:互聯網
上載者:User
菜單|菜單 示範: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 & "' 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 &"' valign='bottom' style='" & _
"font-size:12px;color:"&TitleColor&";cursor: hand;' background='"&Background&"' align='left'>  {$HeadImage}" & Title & "</td></tr></table><div id=" & chr(34) & ID & chr(34) & " style=" &chr(34) & _
"display:none;"& chr(34) & "><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="&chr(34)&"JavaScript"&chr(34)&"type="&chr(34)&"text/JavaScript"&chr(34)& _
">"&vbcrlf&"<!--"&vbcrlf&"function menus(str){"&vbcrlf&"var obj;if (document.getElementById(str)){"&vbcrlf& _
"obj=document.getElementById(str);"& _
"if (obj.style.display =="&chr(34)&"none"&chr(34)&"){obj.style.display ="&chr(34)&chr(34)& _
";}else{obj.style.display ="&chr(34)&"none"&chr(34)&";}}}//--></script>"

response.Write JScript
End Function

Public Sub AddNew()
Title = ""
ID = ""
menuItem = ""
menuStr = ""
End Sub

Public Sub OpenItem(Byval ItemID)

End Sub

end class
%>

使用方法:
<%
Dim NewMenus
Set NewMenus = new menus
NewMenus.Target = "" '開啟檔案
NewMenus.Bgcolor = "#336699" '主標籤背景色
NewMenus.TitleColor = "#FFFFFF" '主標籤字型顏色
NewMenus.Height = "10px" '高度
NewMenus.Style ="a1" '子標籤樣式
NewMenus.Width = "100%" '菜單寬度

NewMenus.AddNew
NewMenus.Title = "門戶網站"
NewMenus.ID = "menu1"
NewMenus.AddItem "網易", "http://www.163.com"
NewMenus.AddItem "搜狐", "http://www.sohu.com"
NewMenus.Show

NewMenus.AddNew
NewMenus.Title = "個人網站"
NewMenus.ID = "menu2"
NewMenus.AddItem "IEBSoft studio", "http://iebsoft.512j.com"
NewMenus.AddItem "租用的空間", "http://107814.hxidc.com"
NewMenus.Show

NewMenus.AddNew
NewMenus.Title = "網站新聞管理"
NewMenus.ID = "menu3"
NewMenus.AddItem



相關文章

Beyond APAC's No.1 Cloud

19.6% IaaS Market Share in Asia Pacific - Gartner IT Service report, 2018

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。