首頁 > 後端開發 > C#.Net教程 > 一個ASP寫的側邊選單欄

一個ASP寫的側邊選單欄

怪我咯
發布: 2017-03-31 11:30:07
原創
2877 人瀏覽過

一個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=&#39;font-size:12px;&#39; align=&#39;left&#39;>    {$Image}<a href=&#39;" & nURL & "&#39; target=&#39;"&Target&"&#39; class=&#39;"& Style &"&#39;>" & nItem & "</a></td></tr>"
End Function
Public Sub Show()
 menuStr = "<table border=0 width=&#39;"& Width &"&#39; style=&#39;border:1px solid #999999;&#39; bgcolor=&#39;"& Bgcolor &"&#39;><tr><td height=&#39;"& Height &"&#39; Onclick=menus(&#39;" & ID & "&#39;) bgcolor=&#39;"& Bgcolor &"&#39; valign=&#39;bottom&#39; style=&#39;" & _
 "font-size:12px;color:"&TitleColor&";cursor: hand;&#39; background=&#39;"&Background&"&#39; align=&#39;left&#39;>  {$HeadImage}" & Title & "</td></tr></table><p id=" & chr(34) & ID & chr(34) & " style=" &chr(34) & _
 "display:none;"& chr(34) & "><table width=100% border=0 style=&#39;border-left:1px solid #999999;border-right:1px solid #999999;border-bottom:1px solid #999999;&#39;>" & menuItem & "</table></p>"
 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
%>
登入後複製

一個ASP寫的側邊選單欄
一個ASP寫的側邊選單欄
#使用方法:

<%
Dim NewMenus
Set NewMenus = new menus
NewMenus.Target = "" &#39;打开方式
NewMenus.Bgcolor = "#336699" &#39;主标签背景色
NewMenus.TitleColor = "#FFFFFF" &#39;主标签字体颜色
NewMenus.Height = "10px" &#39;高度
NewMenus.Style ="a1" &#39;子标签样式
NewMenus.Width = "100%" &#39;菜单宽度
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 "新闻列表", "#"
NewMenus.AddItem "图片新闻", "#"
NewMenus.AddItem "新闻管理", "#"
NewMenus.Show
Set NewMenus = Nothing
%>
登入後複製

一個ASP寫的側邊選單欄

以上是一個ASP寫的側邊選單欄的詳細內容。更多資訊請關注PHP中文網其他相關文章!

相關標籤:
來源:php.cn
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板