欢迎光临
我们一直在努力

一个ASP写的侧边菜单栏-ASP教程,ASP应用

建站超值云服务器,限时71元/月

同于工作的必要,无意之中写出了一个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>&nbsp;&nbsp;&nbsp;&nbsp;{$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>&nbsp;&nbsp;{$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 "新闻列表", "#"

newmenus.additem "图片新闻", "#"

newmenus.additem "新闻管理", "#"

newmenus.show

set newmenus = nothing

%>

赞(0)
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com 特别注意:本站所有转载文章言论不代表本站观点! 本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。未经允许不得转载:IDC资讯中心 » 一个ASP写的侧边菜单栏-ASP教程,ASP应用
分享到: 更多 (0)

相关推荐

  • 暂无文章