Computing.Net > Forums > Programming > javascript for mouse over drop down

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

javascript for mouse over drop down

Reply to Message Icon

Name: br1an
Date: February 28, 2003 at 20:05:16 Pacific
OS: Windows
CPU/Ram: 256
Comment:

Hi,
Does any one know how to make a mouse over drop down menu by JavaScript ?
Please have a look at:
www.national.com.au
for further example. I need to design a nav menu like the one in that site but got a bit of trouble to start. A little example will be a great help,
Best regards,



Sponsored Link
Ads by Google

Response Number 1
Name: Jaap
Date: March 1, 2003 at 00:40:47 Pacific
Reply:

Hi, I've found the javascript code, copy and past it.


body{font-family:verdana;}
table{font-size:80%;background:black}
a{color:black;text-decoration:none;font:bold}
a:hover{color:red}
td.menu{background:yellow}
table.menu
{
font-size:100%;
position:absolute;
visibility:hidden;
}


function toonmenu(elmnt)
{
document.all(elmnt).style.visibility="visible"
}
function verstopmenu(elmnt)
{
document.all(elmnt).style.visibility="hidden"
}

Site 1

something
something
something
hi
bye

Site 2

Wie
Wat
Waar
Waarom
Wanneer

Site 3

Wie
Wat
Waar
Waarom
Wanneer


Or visit Dynamic Drive, and search for top menu's, most script's are for all internet browsers, and Netscape 6.

Greetz from the Netherlands
Jaap


0

Response Number 2
Name: Jaap
Date: March 1, 2003 at 07:09:06 Pacific
Reply:

Sorry something went wrong with the script-code. I'll give it another go asap. First some testing...

<html>
<body>
<style>
body{font-family:verdana;}
table{font-size:80%;background:black}
a{color:black;text-decoration:none;font:bold}
a:hover{color:red}
td.menu{background:yellow}
table.menu
{
font-size:100%;
position:absolute;
visibility:hidden;
}
</style>


0

Response Number 3
Name: Jaap
Date: March 1, 2003 at 07:39:39 Pacific
Reply:

Response #2 looks better, now just a little more testing...

<script language="JavaScript">
function showmenu(elmnt)
{
document.all(elmnt).style.visibility="visible"
}
function hidemenu(elmnt)
{
document.all(elmnt).style.visibility="hidden"
}
</script>
<title></title>
</head>
<body bgcolor="#000000">
<table width="100%">
<tr bgcolor="yellow">
<td onmouseover="showmenu('site1')" onmouseout="hidemenu('site1')">
<a href="index.htm">Site 1
<table class="menu" id="site1" width="100%">
<tr><td class="menu"><a href="pag1.htm">something</a></td></tr>
<tr><td class="menu"><a href="pag2.htm">something</a></td></tr>
<tr><td class="menu"><a href="pag3.htm">something</a></td></tr>
<tr><td class="menu"><a href="pag4.htm">hi</a></td></tr>
<tr><td class="menu"><a href="pag5.htm">bye</a></td></tr>
</table>
</td>


0

Response Number 4
Name: Jaap
Date: March 1, 2003 at 07:58:53 Pacific
Reply:

It's starting to look like it should become, so here is the complete script-code.
The different menu items are colored red.

Every line that begins with <tr><td> ends with </td></tr>, in other words that's one line.

<html>
<body>
<style>
body{font-family:verdana;}
table{font-size:80%;background:black}
a{color:black;text-decoration:none;font:bold}
a:hover{color:red}
td.menu{background:yellow}
table.menu
{
font-size:100%;
position:absolute;
visibility:hidden;
}
</style>
<script language="JavaScript">
function showmenu(elmnt)
{
document.all(elmnt).style.visibility="visible"
}
function hidemenu(elmnt)
{
document.all(elmnt).style.visibility="hidden"
}
</script>
<title></title>
</head>
<body bgcolor="#000000">
<table width="100%">
<tr bgcolor="yellow">
<td onmouseover="showmenu('site1')" onmouseout="hidemenu('site1')">
<a href="index.htm">Site 1
<table class="menu" id="site1" width="100%">
<tr><td class="menu"><a href="pag1.htm">something</a></td></tr>
<tr><td class="menu"><a href="pag2.htm">something</a></td></tr>
<tr><td class="menu"><a href="pag3.htm">something</a></td></tr>
<tr><td class="menu"><a href="pag4.htm">hi</a></td></tr>
<tr><td class="menu"><a href="pag5.htm">bye</a></td></tr>
</table>
</td>
<td onmouseover="showmenu('site2')" onmouseout="hidemenu('site2')">
<a href="http://www.site2.nl">Site 2</a><br />
<table class="menu" id="site2" width="100%">
<tr><td class="menu"><a href="http://www.your-domain.ext/pag1.htm">Who</a></td></tr>
<tr><td class="menu"><a href="http://www.site2.nl/pag2.htm">What</a></td></tr>
<tr><td class="menu"><a href="http://www.site2.nl/pag3.htm">Where</a></td></tr>
<tr><td class="menu"><a href="http://www.site2.nl/pag4.htm">Why</a></td></tr>
<tr><td class="menu"><a href="http://www.site2.nl/pag5.htm">When</a></td></tr>
</table>
</td>
<td onmouseover="showmenu('site3')" onmouseout="hidemenu('site3')">
<a href="http://www.site3.nl">Site 3</a><br />
<table class="menu" id="site3" width="100%">
<tr><td class="menu"><a href="http://www.site3.nl/pag1.htm">Who</a></td></tr>
<tr><td class="menu"><a href="http://www.site3.nl/pag2.htm">What</a></td></tr>
<tr><td class="menu"><a href="http://www.site3.nl/pag3.htm">Where</a></td></tr>
<tr><td class="menu"><a href="http://www.site3.nl/pag4.htm">Why</a></td></tr>
<tr><td class="menu"><a href="http://www.site3.nl/pag5.htm">When</a></td></tr>
</table>
</td>
</table>
</body>
</html>

Greetz from the Netherlands,
Jaap


0

Response Number 5
Name: br1an
Date: March 1, 2003 at 19:36:59 Pacific
Reply:

oh man thats great..i'm trying it now.
anyway thanks a lot for your time :)
Regards,
Brian


0

Related Posts

See More



Response Number 6
Name: br1an
Date: March 1, 2003 at 19:39:00 Pacific
Reply:

by the way is your surname Stam !?? :P


0

Response Number 7
Name: Jaap
Date: March 2, 2003 at 02:58:37 Pacific
Reply:

You are welcome, and good luck.

Not even close...

Jaap


0

Response Number 8
Name: muska
Date: March 3, 2003 at 08:12:32 Pacific

Response Number 9
Name: mesich
Date: March 8, 2003 at 09:29:03 Pacific
Reply:

WOW! Nice job Jaap!

Mesich


0

Response Number 10
Name: Jaap
Date: March 9, 2003 at 07:15:05 Pacific
Reply:

Thanks Mr. Mesich, because i'm building my own site i know where I could find the script.


Greetz from the Netherlands
Jaap :P


0

Sponsored Link
Ads by Google
Reply to Message Icon






Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: javascript for mouse over drop down

Mouse over www.computing.net/answers/programming/mouse-over-/6086.html

Javascript Drop Down Menu..... www.computing.net/answers/programming/javascript-drop-down-menu/7574.html

click for info (drop down) www.computing.net/answers/programming/click-for-info-drop-down/6103.html