/    Sign up×
Community /Pin to ProfileBookmark

Creating a small dynamic menu

Hello everyone,

I have created a page for my boss that has links like the following…

>

Title A (not a link)
> Link 1 (is a link)
> Link 2 (is a link)
> Title (is a link)

The menu is in a table in the middle of the page.

She would like to have it a more compact to look like the following.

>

Title A
> Title B

When you click Title A you would then see the items under Title A.

I am not exactly how to do this or how hard it is to do this. I have seen Javascript in a few places but it looks a little complicated.

I am wondering if I should just push back.

What do you all think?

to post a comment
HTML

4 Comments(s)

Copy linkTweet thisAlerts:
@CentauriAug 26.2008 — Have a look at this article - a drop down menu that only uses a small javascript for IE6 to work.
Copy linkTweet thisAlerts:
@JMRKERAug 31.2008 — While this does not use the .htc in the post above, it does work in IE and FF.
[code=php]
<html>
<head>
<title>DIV menus</title>
<style type="text/css">
.Titles {
background-color:cyan;
font-size: 1.5em;
text-decoration: none;
}
.mTitles {
display:none;
background-color:yellow;
width:200px;
}
</style>
<script type="text/javascript">
// From: http://www.webdeveloper.com/forum/showthread.php?t=189854

function Toggle(Info) {
var CState = document.getElementById(Info).style;
if ((CState.display == "none") || (CState.display == "")) { CState.display = "block"; }
else { CState.display = "none"; }
}
</script>
</head>
<body>
<a href="#" onclick="Toggle('titleA')" class="Titles" size="20">Title A</a> (not a link)<br>
<div id="titleA" class="mTitles">
<a href="javascript:alert('Put link 1 here')">Link 1</a> (is a link)<br>
<a href="javascript:alert('Put link 2 here')">Link 2</a> (is a link)<br>
<a href="javascript:alert('Put link 3 here')">Link 3</a> (is a link)<br>
</div>

<a href="#" onclick="Toggle('titleB')" class="Titles">Title B</a> (not a link)<br>
<div id="titleB" class="mTitles">
<a href="javascript:alert('Put link 1 here')">Link 1</a> (is a link)<br>
<a href="javascript:alert('Put link 2 here')">Link 2</a> (is a link)<br>
<a href="javascript:alert('Put link 3 here')">Link 3</a> (is a link)<br>
</div>

</body>
</html>
[/code]

Replace the 'javascript:alert()" messages with your appropriate links.

I removed the 'underline' in the 'Title A' with CSS.

Doesn't get much simpler than this. ?
Copy linkTweet thisAlerts:
@bigbavarianauthorSep 02.2008 — This is wonderful. Thank you.
Copy linkTweet thisAlerts:
@JMRKERSep 03.2008 — You're most welcome.

We're glad we were able to help.

Good Luck! ?
×

Success!

Help @bigbavarian 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 5.21,
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: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

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

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...