/    Sign up×
Community /Pin to ProfileBookmark

navigation bar ,does not remember down image

Hello,

I am trying to set up a navigation bar , that switches the images onClick, my code works, but the down picture will not stay down. Why wont my down image stay on the down state?

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@KravvitzSep 13.2005 — Perhaps someone would help you if you provided us with a link to the page.
Copy linkTweet thisAlerts:
@cynbyondauthorSep 13.2005 — Below is the code, do I need a dummy variable or an array to do this?

<script language="JavaScript">

<!--

/* Functions that swaps down images. */

function MM_nbGroup(event, group1) { //v6.0

var i,img,nbArr,args=MM_nbGroup.arguments;

if (event == "init" && args.length > 2) {

if ((img = MM_findObj(args[2])) != null && !img.MM_init) {

img.MM_init = true; img.MM_up = args[3]; img.MM_dn = img.src;

if ((nbArr = document[group1]) == null) nbArr = document[group1] = new Array();

nbArr[nbArr.length] = img;

for (i=4; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {

if (!img.MM_up) img.MM_up = img.src;

img.src = img.MM_dn = args[i+1];

nbArr[nbArr.length] = img;

} }

} else if (event == "over") {

document.MM_nbOver = nbArr = new Array();

for (i=1; i < args.length-1; i+=3) if ((img = MM_findObj(args[i])) != null) {

if (!img.MM_up) img.MM_up = img.src;

img.src = (img.MM_dn && args[i+2]) ? args[i+2] : ((args[i+1])?args[i+1] : img.MM_up);

nbArr[nbArr.length] = img;

}

} else if (event == "out" ) {

for (i=0; i < document.MM_nbOver.length; i++) { img = document.MM_nbOver[i]; img.src = (img.MM_dn) ? img.MM_dn : img.MM_up; }

} else if (event == "down") {

nbArr = document[group1];

if (nbArr) for (i=0; i < nbArr.length; i++) { img=nbArr[i]; img.src = img.MM_up; img.MM_dn = 0; }

document[group1] = nbArr = new Array();

for (i=2; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {

if (!img.MM_up) img.MM_up = img.src;

img.src = img.MM_dn = (args[i+1])? args[i+1] : img.MM_up;

nbArr[nbArr.length] = img;

} }

}



</script>

</head>



<cfoutput query="qGetCatNameSe">



<td cellpadding="0" cellspacing="0" > <a href="bobb11.cfm?CID=#qGetCatNameSe.CatID#"
onClick="MM_nbGroup('down','group1','#qGetCatNameSe.CatName#','buttons/searcha.gif',1);"
onMouseOver="MM_nbGroup('over','#qGetCatNameSe.CatName#','buttons/searchnah.gif','buttons/searcha.gif',1);"
onMouseOut="MM_nbGroup('out')"><img src="buttons/searcha.gif" alt="Search" name="#qGetCatNameSe.CatName#" border="0" align="absbottom" onload="MM_nbGroup('init','group1','#qGetCatNameSe.CatName#','#qGetCatNameSe.CatNameP#',1)" ></a>
</td>

</cfoutput>

<cfoutput query="qGetCatNameSo">

<td cellpadding="0" cellspacing="0" > <a href="bobb11.cfm?CID=#qGetCatNameSo.CatID#"

onMouseOver="MM_nbGroup('over','#qGetCatNameSo.CatName#','buttons/shopnah.gif','buttons/shopa.gif',1)"

onMouseOut="MM_nbGroup('out')">

<img src="#qGetCatNameSo.CatNameP#" alt="Shop" name="#qGetCatNameSo.CatName#" border="0" onClick="MM_nbGroup('down','group1','#qGetCatNameSo.CatName#','buttons/shopa.gif',1)"></a></td>

</cfoutput>
Copy linkTweet thisAlerts:
@cynbyondauthorSep 13.2005 — the code works but the down image does not stay to the down image.

its the same page that reloads.
×

Success!

Help @cynbyond spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...