How to Create a popup menu

D

dennishancy

On my web site, I have a "Links" link.

Rather than create a separate HTML file listing all the links, I'd like
to create a popup menu (not sure if that's the official name or not).

So, when I click on "Links", I'd like to have a small popup menu appear
with a list of all my links, from which the user can select one.

Is there a way to do this within Javascript?
Dennis Hancy
Eaton Corporation
Cleveland, OH
 
M

McKirahan

On my web site, I have a "Links" link.

Rather than create a separate HTML file listing all the links, I'd like
to create a popup menu (not sure if that's the official name or not).

So, when I click on "Links", I'd like to have a small popup menu appear
with a list of all my links, from which the user can select one.

Is there a way to do this within Javascript?
Dennis Hancy
Eaton Corporation
Cleveland, OH

You might consider a drop-down list; for example:

<html>
<head>
<title>linkpick.htm</title>
<script type="text/javascript">
function link() {
var form = document.form1;
var site = form.links.options[form.links.selectedIndex].value;
if (site == "") return;
location.href = "http://" + site;
}
</script>
</head>
<body>
<form name="form1">
<b>Pick a link:</b><br>
<select name="links" onchange="link()">
<option value="" selected>
<option value="www.google.com">Google
<option value="www.yahoo.com">Yahoo
</select>
</form>
</body>
</html>
 
R

Richard

On my web site, I have a "Links" link.
Rather than create a separate HTML file listing all the links, I'd like
to create a popup menu (not sure if that's the official name or not).
So, when I click on "Links", I'd like to have a small popup menu appear
with a list of all my links, from which the user can select one.
Is there a way to do this within Javascript?


Try this little script

var kid = "FirstOn"
function ShowInfo(DivId)
{
document.getElementById(kid).style.display = 'none';
document.getElementById(DivId).style.display = 'block';
kid = DivId;
}

"FirstOn" is your opening division.
<div id="FirstOn" style="display:block;">Text</div>

Further items can be opened as needed with
<div id="item1" style="display:none;">links links links what ever</div>

Then when you want to show it, onclick="ShowInfo('item1')"

Basically works the same way as an image swap.

As an example see my site.
www.somestuff.batcave.net/menu1.html
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Staff online

Members online

Forum statistics

Threads
473,764
Messages
2,569,566
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top