JackieD
12-16-2005, 01:46 PM
Hello folks,
As y'all can see I'm pretty new to this forum and also pretty new to JScripting.
The issue I'm encountering is that I want to Implement a specific DropDownMenu but with a little bit of change to it.
The menu as it is uses Per menu lvl the same background image and for each of the sublvls a different one. Alas what I wanna do is use different background Images for each button on the same menu lvl, and for the sublvls the same image as the button of the lvl above.
This is the code of the entire code for the Menu so u may get an overview on how the Menu is working, further down I will isolate the code parts where the background images get initialised
<html>
<head>
<title>DHTMLCentral.com - Free Dynamic HTML Scripts - slideMenu2 Demo</title>
<meta name="Author" content="Thomas Brattli (webmaster@dhtmlcentral.com)">
<META NAME="Generator" CONTENT="Designer:Thomas Brattli (www.bratta.com)">
<meta name="KeyWords" content="DHTML, HTML, Dynamic HTML, Javascript, Cascading Style Sheets, Cross-browser, Cross browser, Javascripts, DOM, Scripts, Free Scripts">
<meta name="Description" content="Dynamic HTML Central - The ultimate place to find DHTML scripts, demos, tutorials and help.">
<style type="text/css">
div.clSlideMenu{ /* All slideMenu2 DIV elements */
position:absolute;
font-family:verdana,arial,helvetica;
font-size:10px;
overflow:hidden;
height:22;
}
a.clA0{ /* All top level links */
color:white;
font-size:12px;
text-decoration:none;
font-weight:bold;
}
a.clA1{ /* All sub level links */
color:black;
font-size:11px;
font-weight:bold;
text-decoration:none;
}
a.clA2{ /* All sub2 level links */
color:navy;
text-decoration:none;
}
a.clA3{ /* All sub3 level links */
color:black;
text-decoration:none;
}
a.clA4{ /* All sub4 level links */
color:green;
text-decoration:none;
}
/* NEEDED STYLES */
div.slideMenuBG{position:absolute; left:0; top:0; z-index:1}
div.slideMenuText{position:absolute; left:2; top:2; text-align:left; z-index:200}
#slideMenucont{position:absolute; width:120; visibility:hidden;}
</style>
<script language="JavaScript" src="slidemenu.js" type="text/javascript">
/**********************************************************************************
SlideMenu 2.0
* Copyright (C) 2002 Thomas Brattli
* This script was released at DHTMLCentral.com
* Visit for more great scripts!
* This may be used and changed freely as long as this msg is intact!
* We will also appreciate any links you could give us.
*
* Made by Thomas Brattli
*
*Script date: 08/05/2002 (keep this date to check versions)
*********************************************************************************/
</script>
</head><body marginleft="0" bgcolor="white" marginheight="0">
<script>
slideMenu = new createSlideMenu("slideMenu")
//Variables to set:
slideMenu.menuy=60 //The top placement of the menu.
slideMenu.menux=(window["innerWidth"]||document.body.offsetWidth)-210 //The left placement of the menu
slideMenu.useImages = 1 //Are you using images or not?
slideMenu.pxspeed=16 //The pixel speed of the animation
slideMenu.timspeed=25 //The timer speed of the animation
slideMenu.inset = -10 //How much the selected elements should pop to the left
slideMenu.arrow=0
//Needed dummy classes
slideMenu.bgClass = "slideMenuBG"
slideMenu.txtClass = "slideMenuText"
//Level properties - ALL properties have to be spesified in level 0
//This works the same way as the CM4 script (if you have seen it)
slideMenu.level[0] = new slideMenu_makeLevel(
left = 52,
width = 138,
height = 21,
between = 0,
className = "clSlideMenu",
classNameA = "clA0",
regImage = "level0_regular__Right.gif",
roundImg = "level0_round.gif",
roundImg2 = "",
subImg = "",
subRound= "")
slideMenu.level[1] = new slideMenu_makeLevel(42,127,20,2,"clSlideMenu","clA1","level1_regular.gif","level1_round2.gif","level1_round.gif","level1_sub.gif", "level1_sub_round.gif")
slideMenu.level[2] = new slideMenu_makeLevel(33,118,18,2,"clSlideMenu","clA2","level2_regular.gif","level2_round2.gif","level2_round.gif", "level2_sub.gif", "level2_sub_round.gif")
slideMenu.level[3] = new slideMenu_makeLevel(21,108,20,2,"clSlideMenu","clA3","level3_regular.gif","level3_round2.gif","level3_round.gif","level3_sub.gif","level3_sub_round.gif")
slideMenu.level[4] = new slideMenu_makeLevel(10,107,19,2,"clSlideMenu","clA4","level4_regular.gif", "level4_round2.gif","level4_round.gif","level4_sub.gif", "level4_sub_round.gif")
//Image preload --- leave this
for(var i=0;i<slideMenu.level;i++){
var l = slideMenu.level[i]
new preLoadBackgrounds(l.regImage,l.roundImg,l.roundImg2,l.subImg,l.subRound)
}
//Menu 1
slideMenu.makeMenu('top','Home')
slideMenu.makeMenu('top','News')
slideMenu.makeMenu('sub','Aktuelles','/script/search.asp?new=1')
slideMenu.makeMenu('sub','Formatiounen','/script/index.asp')
slideMenu.makeMenu('sub','Archiver')
slideMenu.makeMenu('top','Projets')
slideMenu.makeMenu('sub','Présidence','/script/search.asp?new=1')
slideMenu.makeMenu('sub','Jonk Schwätzt','/script/index.asp')
slideMenu.makeMenu('sub','Jonk Wielt','')
slideMenu.makeMenu('top','Guide du Jeune Citoyen')
slideMenu.makeMenu('sub','Portraiten','')
slideMenu.makeMenu('sub','Témoignagen vu Jonken','')
slideMenu.makeMenu('sub','Referenzen a Ressourcen','')
slideMenu.makeMenu('sub','Zesummeliewen','')
slideMenu.makeMenu('sub','Background an Informatiounen','')
slideMenu.makeMenu('sub','Concouren a Präisser','')
slideMenu.makeMenu('top','Infos')
slideMenu.makeMenu('sub','Memberorganisatiounen','/script/search.asp?new=1')
slideMenu.makeMenu('sub','Kontakter','/script/index.asp')
slideMenu.makeMenu('sub','Links')
slideMenu.init()
</script>
</body>
</html>
This is the Part where the background image gets set in place for the main menu items:
/Level properties - ALL properties have to be spesified in level 0
//This works the same way as the CM4 script (if you have seen it)
slideMenu.level[0] = new slideMenu_makeLevel(
left = 52,
width = 138,
height = 21,
between = 0,
className = "clSlideMenu",
classNameA = "clA0",
regImage = "level0_regular__Right.gif",
roundImg = "level0_round.gif",
roundImg2 = "",
subImg = "",
subRound= "")
and this for the subsequent sublvls
slideMenu.level[1] = new slideMenu_makeLevel(42,127,20,2,"clSlideMenu","clA1","level1_regular.gif","level1_round2.gif","level1_round.gif","level1_sub.gif", "level1_sub_round.gif")
slideMenu.level[2] = new slideMenu_makeLevel(33,118,18,2,"clSlideMenu","clA2","level2_regular.gif","level2_round2.gif","level2_round.gif", "level2_sub.gif", "level2_sub_round.gif")
slideMenu.level[3] = new slideMenu_makeLevel(21,108,20,2,"clSlideMenu","clA3","level3_regular.gif","level3_round2.gif","level3_round.gif","level3_sub.gif","level3_sub_round.gif")
slideMenu.level[4] = new slideMenu_makeLevel(10,107,19,2,"clSlideMenu","clA4","level4_regular.gif", "level4_round2.gif","level4_round.gif","level4_sub.gif", "level4_sub_round.gif")
and last but not least the part where the pre-loading occurs:
//Image preload --- leave this
for(var i=0;i<slideMenu.level;i++){
var l = slideMenu.level[i]
new preLoadBackgrounds(l.regImage,l.roundImg,l.roundImg2,l.subImg,l.subRound)
}
As u clearly can see in the above code the image only gets set in place for the different menu lvls and not i.e. for the specific button.
My apologies for my not so good english but sadly I'm not native to the language, nonetheless I hope somebody will be able to help me.
If be any means I u need more clarification on my issue, do not hesitate to tell me so.
Thanks in advance
Steve
As y'all can see I'm pretty new to this forum and also pretty new to JScripting.
The issue I'm encountering is that I want to Implement a specific DropDownMenu but with a little bit of change to it.
The menu as it is uses Per menu lvl the same background image and for each of the sublvls a different one. Alas what I wanna do is use different background Images for each button on the same menu lvl, and for the sublvls the same image as the button of the lvl above.
This is the code of the entire code for the Menu so u may get an overview on how the Menu is working, further down I will isolate the code parts where the background images get initialised
<html>
<head>
<title>DHTMLCentral.com - Free Dynamic HTML Scripts - slideMenu2 Demo</title>
<meta name="Author" content="Thomas Brattli (webmaster@dhtmlcentral.com)">
<META NAME="Generator" CONTENT="Designer:Thomas Brattli (www.bratta.com)">
<meta name="KeyWords" content="DHTML, HTML, Dynamic HTML, Javascript, Cascading Style Sheets, Cross-browser, Cross browser, Javascripts, DOM, Scripts, Free Scripts">
<meta name="Description" content="Dynamic HTML Central - The ultimate place to find DHTML scripts, demos, tutorials and help.">
<style type="text/css">
div.clSlideMenu{ /* All slideMenu2 DIV elements */
position:absolute;
font-family:verdana,arial,helvetica;
font-size:10px;
overflow:hidden;
height:22;
}
a.clA0{ /* All top level links */
color:white;
font-size:12px;
text-decoration:none;
font-weight:bold;
}
a.clA1{ /* All sub level links */
color:black;
font-size:11px;
font-weight:bold;
text-decoration:none;
}
a.clA2{ /* All sub2 level links */
color:navy;
text-decoration:none;
}
a.clA3{ /* All sub3 level links */
color:black;
text-decoration:none;
}
a.clA4{ /* All sub4 level links */
color:green;
text-decoration:none;
}
/* NEEDED STYLES */
div.slideMenuBG{position:absolute; left:0; top:0; z-index:1}
div.slideMenuText{position:absolute; left:2; top:2; text-align:left; z-index:200}
#slideMenucont{position:absolute; width:120; visibility:hidden;}
</style>
<script language="JavaScript" src="slidemenu.js" type="text/javascript">
/**********************************************************************************
SlideMenu 2.0
* Copyright (C) 2002 Thomas Brattli
* This script was released at DHTMLCentral.com
* Visit for more great scripts!
* This may be used and changed freely as long as this msg is intact!
* We will also appreciate any links you could give us.
*
* Made by Thomas Brattli
*
*Script date: 08/05/2002 (keep this date to check versions)
*********************************************************************************/
</script>
</head><body marginleft="0" bgcolor="white" marginheight="0">
<script>
slideMenu = new createSlideMenu("slideMenu")
//Variables to set:
slideMenu.menuy=60 //The top placement of the menu.
slideMenu.menux=(window["innerWidth"]||document.body.offsetWidth)-210 //The left placement of the menu
slideMenu.useImages = 1 //Are you using images or not?
slideMenu.pxspeed=16 //The pixel speed of the animation
slideMenu.timspeed=25 //The timer speed of the animation
slideMenu.inset = -10 //How much the selected elements should pop to the left
slideMenu.arrow=0
//Needed dummy classes
slideMenu.bgClass = "slideMenuBG"
slideMenu.txtClass = "slideMenuText"
//Level properties - ALL properties have to be spesified in level 0
//This works the same way as the CM4 script (if you have seen it)
slideMenu.level[0] = new slideMenu_makeLevel(
left = 52,
width = 138,
height = 21,
between = 0,
className = "clSlideMenu",
classNameA = "clA0",
regImage = "level0_regular__Right.gif",
roundImg = "level0_round.gif",
roundImg2 = "",
subImg = "",
subRound= "")
slideMenu.level[1] = new slideMenu_makeLevel(42,127,20,2,"clSlideMenu","clA1","level1_regular.gif","level1_round2.gif","level1_round.gif","level1_sub.gif", "level1_sub_round.gif")
slideMenu.level[2] = new slideMenu_makeLevel(33,118,18,2,"clSlideMenu","clA2","level2_regular.gif","level2_round2.gif","level2_round.gif", "level2_sub.gif", "level2_sub_round.gif")
slideMenu.level[3] = new slideMenu_makeLevel(21,108,20,2,"clSlideMenu","clA3","level3_regular.gif","level3_round2.gif","level3_round.gif","level3_sub.gif","level3_sub_round.gif")
slideMenu.level[4] = new slideMenu_makeLevel(10,107,19,2,"clSlideMenu","clA4","level4_regular.gif", "level4_round2.gif","level4_round.gif","level4_sub.gif", "level4_sub_round.gif")
//Image preload --- leave this
for(var i=0;i<slideMenu.level;i++){
var l = slideMenu.level[i]
new preLoadBackgrounds(l.regImage,l.roundImg,l.roundImg2,l.subImg,l.subRound)
}
//Menu 1
slideMenu.makeMenu('top','Home')
slideMenu.makeMenu('top','News')
slideMenu.makeMenu('sub','Aktuelles','/script/search.asp?new=1')
slideMenu.makeMenu('sub','Formatiounen','/script/index.asp')
slideMenu.makeMenu('sub','Archiver')
slideMenu.makeMenu('top','Projets')
slideMenu.makeMenu('sub','Présidence','/script/search.asp?new=1')
slideMenu.makeMenu('sub','Jonk Schwätzt','/script/index.asp')
slideMenu.makeMenu('sub','Jonk Wielt','')
slideMenu.makeMenu('top','Guide du Jeune Citoyen')
slideMenu.makeMenu('sub','Portraiten','')
slideMenu.makeMenu('sub','Témoignagen vu Jonken','')
slideMenu.makeMenu('sub','Referenzen a Ressourcen','')
slideMenu.makeMenu('sub','Zesummeliewen','')
slideMenu.makeMenu('sub','Background an Informatiounen','')
slideMenu.makeMenu('sub','Concouren a Präisser','')
slideMenu.makeMenu('top','Infos')
slideMenu.makeMenu('sub','Memberorganisatiounen','/script/search.asp?new=1')
slideMenu.makeMenu('sub','Kontakter','/script/index.asp')
slideMenu.makeMenu('sub','Links')
slideMenu.init()
</script>
</body>
</html>
This is the Part where the background image gets set in place for the main menu items:
/Level properties - ALL properties have to be spesified in level 0
//This works the same way as the CM4 script (if you have seen it)
slideMenu.level[0] = new slideMenu_makeLevel(
left = 52,
width = 138,
height = 21,
between = 0,
className = "clSlideMenu",
classNameA = "clA0",
regImage = "level0_regular__Right.gif",
roundImg = "level0_round.gif",
roundImg2 = "",
subImg = "",
subRound= "")
and this for the subsequent sublvls
slideMenu.level[1] = new slideMenu_makeLevel(42,127,20,2,"clSlideMenu","clA1","level1_regular.gif","level1_round2.gif","level1_round.gif","level1_sub.gif", "level1_sub_round.gif")
slideMenu.level[2] = new slideMenu_makeLevel(33,118,18,2,"clSlideMenu","clA2","level2_regular.gif","level2_round2.gif","level2_round.gif", "level2_sub.gif", "level2_sub_round.gif")
slideMenu.level[3] = new slideMenu_makeLevel(21,108,20,2,"clSlideMenu","clA3","level3_regular.gif","level3_round2.gif","level3_round.gif","level3_sub.gif","level3_sub_round.gif")
slideMenu.level[4] = new slideMenu_makeLevel(10,107,19,2,"clSlideMenu","clA4","level4_regular.gif", "level4_round2.gif","level4_round.gif","level4_sub.gif", "level4_sub_round.gif")
and last but not least the part where the pre-loading occurs:
//Image preload --- leave this
for(var i=0;i<slideMenu.level;i++){
var l = slideMenu.level[i]
new preLoadBackgrounds(l.regImage,l.roundImg,l.roundImg2,l.subImg,l.subRound)
}
As u clearly can see in the above code the image only gets set in place for the different menu lvls and not i.e. for the specific button.
My apologies for my not so good english but sadly I'm not native to the language, nonetheless I hope somebody will be able to help me.
If be any means I u need more clarification on my issue, do not hesitate to tell me so.
Thanks in advance
Steve