Change menubgimage

Having problems with DHTML Menu? There is usually somebody here who knows the answer.
Post Reply
guiafreis
Beginner
Beginner
Posts: 1
Joined: Thu May 21, 2009 10:03 am

Change menubgimage

Post by guiafreis » Thu May 21, 2009 10:10 am

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/Imagen ... ckMenu.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/ ... t%>&n=<%=n%>;");
<%
Else
%>
aI("align=center;bgimage=http://psdmatosinhos.websys.pt/Imagens/ ... t%>&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/ ... dex_07.jpg;");
<%
Else
%>
aI("align=center;bgimage=http://psdmatosinhos.websys.pt/Imagens/ ... dex_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/Imagen ... l=<%=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;
}

User avatar
Ruth
 Team
 Team
Posts: 8761
Joined: Thu May 15, 2003 5:02 am
Location: Yucaipa, CA
Contact:

Re: Change menubgimage

Post by Ruth » Sat Jun 06, 2009 3:29 am

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

Post Reply