javascripts
 

SimplytheBest
Scripts

ASP scripts
PERL scripts
PHP scripts
JavaScripts & Ajax
Snippets
Online scripts

Ajax, DHTML
& JavaScripts

Animation
Background
Bookmarks
Buttons
Calculators
Cookies
Data handling
E-mail
Enhancements
Forms
Image rotation
Menus
Messages
Miscellaneous
Music
Password protection
Redirection
Scrollers
Tables
Time & date
Windows

Publishers
Add script
Account login
Publisher list



 

Home > Scripts > DHTML scripts & JavaScripts > Menus > Vertical dropdown menu

 

Vertical dropdown menu script

AUTHOR: Submitted by Stephen Hayes
TYPE: Freeware
BROWSERS: IE 4+, IE 5+, IE 6+

This is a VBscript that produces a dropdown menu from tables. The script was designed to be used as a navigation tool in a frameset, but could be adapted for many uses.


EXAMPLE

Button1
Button2
Button3
Button4


1)
Insert the following style command in the <HEAD> section of the page.

then copy (CTRL-C) & paste (CTRL-V)

2) Insert this script in the <HEAD>, between <HEAD> and <BODY> or in the <BODY> section of the page.

then copy (CTRL-C) & paste (CTRL-V)

3) Insert this HTML code in the <BODY> section where you want the dropdown menu to appear in the page.

then copy (CTRL-C) & paste (CTRL-V)

Modify the script to your needs:

In the style section define the font-family, size and color of the headings and the links in the dropdown menu:

<style>
<!--
a.nav:link { font-family: Verdana,Arial; font-size: 10px; text-decoration: none }
a.nav:visited { font-family: Verdana,Arial; font-size: 10px; text-decoration: none }
a.nav:active { font-family: Verdana,Arial; font-size: 10px; text-decoration: none }
a.nav:hover { font-family: Verdana,Arial; font-size: 10px; text-decoration: none; color: #FF0000 }
.HEADING { cursor: hand; font-family: Verdana,Arial; font-size: 12px; color: #FFFFFF
background-color: #0000FF; font-weight: none
border: 1 solid #000000 }
.LINKSOFF { display: none; font-family: Verdana,Arial; font-size: 12px; color: #000080 }
.LINKSON { display: inline; font-family: Verdana,Arial; font-size: 12px; color: #000080 }
-->
</style>

In the HTML code section, define the background color of the tables, the links and other variables:

<td ID="head0" align="center" width="113" height="15" class="HEADING" ONCLICK="ShowHide(0)">Button1</td>
</tr>
<tr>
<td ALIGN="left" bgcolor="#FFFFCC">
<!-- Menu 1 -->
<div ID="Link0" class="LINKSOFF">
<a class="nav" href="http://simplythebestscripts.com"><b>Script library</b></a><br>
<a class="nav" href="http://simplythebestscripts.com/dhtml/">DHTML scripts</a><br>
<a class="nav" href="http://simplythebestscripts.com/javascripts/">JavaScripts</a><br>
<a class="nav" href="http://simplythebestscripts.com/vbscripts/">VBscripts</a><br>
<a class="nav" href="http://simplythebestscripts.com/cgiscripts/">CGI scripts</a><br>
</div>

You can add as many headers and links as you like. Make sure that the td ID, div ID and ONCLICK tabs are numbered appropriately. Example for a fifth dropdown:

<td ID="head4" align="center" width="113" height="15" class="HEADING" ONCLICK="ShowHide(4)">Button5</td>
</tr>
<tr>
<td ALIGN="left" bgcolor="#FFFFCC">
<!-- Menu 5 -->
<div ID="Link4" class="LINKSOFF">
<a class="nav" href="dhtml_scripts.html"><b>DHTML Scripts</b></a><br>
<a class="nav" href="dhtml_menus.html">DHTML menus</a><br>
</div>


[BACK] [TOP]

 


Copyright © 1997-2009 SimplytheBest Inc. Terms of Use and Legal Disclaimer.
All copyrights are acknowledged. All rights reserved.