Milonic provide full featured pull down web menus for some of the worlds largest companies
click here to see what it can do for you

Download Milonic DHTML Menu
Buy Milonic DHTML Menu

Back To Start Of Archive
Taken From The Forum: Help & Support for DHTML Menu Version 5+
Forum Topic: Click to view post
Last Updated: Saturday July 14 2012 - 06:07:10

Change menubgimage


Poster: guiafreis
Dated: Thursday May 21 2009 - 10:10:10 BST

Hi,

I need to change the menubgimage when i click in different items.

example:

item1 -> menubgimage="1.gif"

item2 -> menubgimage="2.gif"

item3 -> menubgimage="3.gif"

item4 -> menubgimage="4.gif"

It's very urgent to me.

The URL:
http://www.retomaroprogresso.com/index.asp

:? Thanks,
Gui

My code is ASP and HTML:


<!-- ***** MENU SCRIPT CODE ***** -->
<script type="text/javascript" src="milonic_src.js"></script>
<script type="text/javascript" src="mmenudom.js"></script>

<SCRIPT TYPE="text/javascript">
fixMozillaZIndex=true; //Fixes Z-Index problem with Mozilla browsers but causes odd scrolling problem, toggle to see if it helps
_menuCloseDelay=500;
_menuOpenDelay=150;
_subOffsetTop=0;
_subOffsetLeft=0;

with(menuStyle=new mm_style()){
menubgimage="http://www.retomaroprogresso.com/Imagens/PSDGAV_BckMenu.gif";
menubgcolor="#eeeeee";
offclass="menuOffX";
onclass="menuOnX";
}

with(background=new mm_style()){
borderstyle="solid";
fontstyle="normal";
fontfamily="arial,tahoma,serif";
fontsize="9px";
textdecoration="none";
textalign="center";
itemheight=29;
itemwidth=93;
offcolor="#333300";
oncolor="#ffffff";
}



<%
mnpsql="select * from zones where supercatid=0 and navegacao=0 order by menuid asc;"
set mnrs=conn.execute(mnpsql)
do until mnrs.eof
mntit = mnrs("zonenamemenu")
mncat = mnrs("zoneid")
mnscat = mnrs("supercatid")
mnnav = mnrs("navegacao")
%>
<%
Select Case mnnav
Case "True"
%>

<%
Smnpsql="select * from zones where supercatid= "&mncat&" order by zonenamemenu asc;"
set Smnrs=server.createobject("ADODB.Recordset")
Smnrs.open Smnpsql,conn,1
if not(Smnrs.eof) then
maxval=Smnrs.recordcount
cc=0

%>
with(milonic=new menuname("_<%=mncat%>")){
left="offset=+0";
style=background;
<%
do until Smnrs.eof
cc=cc+1
mnstit = Smnrs("zonenamemenu")
mnscat = Smnrs("supercatid")
mnszcat = Smnrs("zoneid")
if cc = maxval Then
%>
aI("align=center;bgimage=http://psdmatosinhos.websys.pt/Imagens/menu1.png;text=<%=mnstit%>;url=<%=siteurl%>SubCategorias.asp?sz=<%=mnszcat%>&z=<%=mnscat%>&n=<%=n%>;");
<%
Else
%>
aI("align=center;bgimage=http://psdmatosinhos.websys.pt/Imagens/menu2.png;text=<%=mnstit%>;url=<%=siteurl%>SubCategorias.asp?sz=<%=mnszcat%>&z=<%=mnscat%>&n=<%=n%>;");
<%
End If
%>
<%
Smnrs.movenext
loop
Smnrs.close
set Smnrs=nothing
%>
}
<%
Else
End If
%>

<%
Case Else
%>
<%
Response.write mncat
Ymnpsql="Select * from vArticlesZones where zoneid="&CInt(mncat)&" order by headline asc;"
set Ymnrs=server.createobject("ADODB.Recordset")
Ymnrs.open Ymnpsql,conn,1
if not(Ymnrs.eof) then
maxvalX=Ymnrs.recordcount
xx=0
%>
with(milonic=new menuname("_<%=mncat%>")){
left="offset=+0";
style=background;
<%
do until Ymnrs.eof
xx=xx+1
Ymntit = Ymnrs("headline")
Ymncat = Ymnrs("zoneid")
Ymnart = Ymnrs("articleid")
n = 1
n=1
if xx = maxvalX Then
%>
aI("align=center;bgimage=http://psdmatosinhos.websys.pt/Imagens/menu1.png;text=<%=Ymntit%>;url=<%=applicationurl%>artigo.asp?a=<%=Ymnart%>&z=<%=Ymncat%>&n=<%=n%>;menubgimage=http://psdmatosinhos.websys.pt/Imagens/index_07.jpg;");
<%
Else
%>
aI("align=center;bgimage=http://psdmatosinhos.websys.pt/Imagens/menu2.png;text=<%=Ymntit%>;url=<%=applicationurl%>artigo.asp?a=<%=Ymnart%>&z=<%=Ymncat%>&n=<%=n%>;menubgimage=http://psdmatosinhos.websys.pt/Imagens/index_07.jpg;");
<%
End If
%>
<%
Ymnrs.movenext
loop
Ymnrs.close
set Ymnrs=nothing
%>
}
<%
Else
End If
%>
<%
End Select
%>

<%
mnrs.movenext
loop
mnrs.close
set mnrs=nothing
%>

drawMenus()
</script>

<SCRIPT TYPE="text/javascript">
with(milonic=new menuname("Main Menu")){
itemwidth=93;
itemheight=31;
menualign="center";
orientation="horizontal";
alwaysvisible=1;
position="relative";
style=menuStyle;
<%
<!-- #include virtual="/conteudos/incSystem.asp"-->
set conn=server.createobject("ADODB.Connection")
conn.open connection
%>
<%
mnpsql="select * from zones where supercatid=0 order by menuid asc;"
set mnrs=conn.execute(mnpsql)
do until mnrs.eof
mntit = mnrs("zonenamemenu")
mnURL = mnrs("zonenameURL")
mncat = mnrs("zoneid")
mnscat = mnrs("supercatid")
mnnav = mnrs("navegacao")
%>
<%
Select Case mnnav
Case "True"
%>
aI("menubgimage=http://www.retomaroprogresso.com/Imagens/PSDGAV_BckMenuX.gif;offbgcolor=transparent;showmenu=_<%=mncat%>;itemwidth=93;text=<%=mntit%>;url=<%=mnURL%>;");
<%
Case Else
%>
aI("showmenu=_<%=mncat%>;itemwidth=93;text=<%=mntit%>;");
<%
End Select
%>
<%
mnrs.movenext
loop
mnrs.close
set mnrs=nothing
%>
}
drawMenus();
</script>

CSS

.menuOffX{
color:#5A5B5D;
font-style:normal;
font-weight:bold;
font-family:arial,tahoma,serif;
font-size:10px;
text-align:center;
margin:0px;
text-decoration: none;
padding-top:0px;
padding-right:0px;
padding-bottom:0px;
padding-left:0px;
}

.menuOnX{
background-image:url(http://psdmatosinhos.websys.pt/Imagens/buthome.png);
color: white;
font-style:normal;
font-weight:bold;
font-family:arial,tahoma,serif;
font-size:10px;
text-align:center;
margin:0px;
text-decoration: none;
padding-top:0px;
padding-right:0px;
padding-bottom:0px;
padding-left:0px;
}

Re: Change menubgimage


Poster: Ruth
Dated: Saturday June 6 2009 - 3:29:55 BST

Hi,

Sorry, I just saw this post. Menubgimage is a static property, it doesn't change. It is an image in the background of the menu. If you want images to change when you mouseover or click an item then you have to use bgimage and overbgimage which will change it for the item that is clicked or moused over.

Ruth