/    Sign up×
Community /Pin to ProfileBookmark

Hi,
I have three links on my menu. Menu 1, Menu2 and Menu3.
If i switch from Menu 1 to Menu 2 the text on menu2 will be written on
top of menu1.

How can i make menu 1 auto hided once i click in any of the other menus.
meaning that, i dont want to click on the same menu title to be closed to switch to another menu.
Here is the code:

[code=html]<HTML>
<HEAD>
<title>Switch Tab Menu – Tests</title>
<META HTTP-EQUIV=”Content-Type” CONTENT=”text/html; charset=windows-1256″>
<Script language=”JavaScript”>
function switchMenu(obj)
{
var el = document.getElementById(obj);
if(el.style.display != “block”)
{
el.style.display = “block”;
return false;
}
else
{
el.style.display = “none”;
}
}
</script>
</head>
<body>
<table cellpadding=”0″ cellspacing=”0″ width=”100%” border=”0″ valign=”top”>
<tr class=Header>
<td class=trcolor align=center width=33%>
<a onclick=”switchMenu(‘nextstep’);” style=’cursor:pointer;cursor:hand’ title=”!”><b>Menu 1</b></a>
</td>
<td class=”pink_color” align=center width=33%>
<a onclick=”switchMenu(‘nextstep2′);” style=’cursor:pointer;cursor:hand’ title=”!”><b>Menu 2 </b></a>

</td>
<td class=”searchform” align=center width=33%>
<a onclick=”switchMenu(‘nextstep3′);” style=’cursor:pointer;cursor:hand’ title=”!”><b>Menu 3 </b></a>
</td>
</tr>

<tr width=100%>
<td colspan=8 align=right valign=top width=100%>
<div id=”nextstep” style=”display:none;” width=100%>
<table border=0 width=100% align=right cellpadding=”0″ cellspacing=”0″>
<tr>
<td align=right colspan= valign=top><b>
Menu 1 Contents

</td>
</tr>
</table>
</div>
<div id=”nextstep2″ style=”display:none;” width=100%>
<table border=0 width=100% align=right colspan=4 class=”pink_color”>
<tr>
<td align=right colspan= valign=top><b>Menu 2 Contents
</td>
</tr>
</table>
</div>
<div id=”nextstep3″ style=”display:none;” width=100%>
<table border=0 width=100% align=right colspan=4 class=”searchform”>
<tr>
<td align=right colspan= valign=top><b>
Menu 3 Contents

</td>
</tr>
</table>
</div>
</td>
</tr>
</table>
</body>
</html>[/code]

I hope that the point is clear.
Thanks in advance.

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@DokJul 22.2007 — How a look and the endless list of tutorials and examples at http://www.google.dk/search?q=javascript+menu+navigation
Copy linkTweet thisAlerts:
@themoonauthorJul 23.2007 — thanks alot
×

Success!

Help @themoon 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,
)...