There are some situations where developers
need to create our custom html JavaScript menu without help of Web designers.
So the below code will help in creating a Custom html JavaScript menu. So Please
follow the below step to see the menu
- Save the CSS code for Menu Code as Menu.css
- Save the JavaScript code for Menu Code as Menu.js
- Save the html code for Menu Code as Menu.htm
- Place all the three files in the same folder
/********************** 1. Menu.css *************************/
.ParentMenu
{
border-right: black 1px solid;
border-top: black 1px solid;
font-weight: lighter;
font-size: 10pt;
left: 10px;
text-transform: uppercase;
border-left: black 1px solid;
width: 100%;
color: teal;
border-bottom: black 1px solid;
font-style: normal;
font-family: verdana;
letter-spacing: 2pt;
position: absolute;
top: 100px;
height: 30px;
background-color: lightyellow;
text-align: center;
cursor: hand;
}
.ChildMenu
{
border-right: black 1px solid;
padding-right: 3px;
display: none;
padding-left: 3px;
font-weight: lighter;
font-size: 10pt;
padding-bottom: 2px;
text-transform: uppercase;
border-left: black 1px solid;
width: 20%;
color: teal;
padding-top: 2px;
border-bottom: black 1px solid;
font-style: normal;
font-family: verdana;
letter-spacing: 2pt;
position: absolute;
top: 129px;
height: 30px;
background-color: lightyellow;
text-align: left;
cursor: hand;
text-decoration: none;
}
A:link
{
text-decoration: none;
color:teal;
}
A:visited
{
text-decoration: none;
color:blue;
}
A:hover
{
text-decoration: none;
color:red;
}
A:active
{
text-decoration: none;
color:teal;
}
/********************** 2. Menu.js *************************/
.ParentMenu
{
border-right: black 1px solid;
border-top: black 1px solid;
font-weight: lighter;
font-size: 10pt;
left: 10px;
text-transform: uppercase;
border-left: black 1px solid;
width: 100%;
color: teal;
border-bottom: black 1px solid;
font-style: normal;
font-family: verdana;
letter-spacing: 2pt;
position: absolute;
top: 100px;
height: 30px;
background-color: lightyellow;
text-align: center;
cursor: hand;
}
.ChildMenu
{
border-right: black 1px solid;
padding-right: 3px;
display: none;
padding-left: 3px;
font-weight: lighter;
font-size: 10pt;
padding-bottom: 2px;
text-transform: uppercase;
border-left: black 1px solid;
width: 20%;
color: teal;
padding-top: 2px;
border-bottom: black 1px solid;
font-style: normal;
font-family: verdana;
letter-spacing: 2pt;
position: absolute;
top: 129px;
height: 30px;
background-color: lightyellow;
text-align: left;
cursor: hand;
text-decoration: none;
}
A:link
{
text-decoration: none;
color:teal;
}
A:visited
{
text-decoration: none;
color:blue;
}
A:hover
{
text-decoration: none;
color:red;
}
A:active
{
text-decoration: none;
color:teal;
}
/********************** 2. Menu.js *************************/
<!--
function showMenu(subMenu)
{
document.all(subMenu).style.display='block';
}
function hideMenu(subMenu)
{
document.all(subMenu).style.display='none';
}
//-->
/********************** 3. Menu.htm *************************/
<html>
<head>
<title>Menu</title>
<LINK href="Menu.css" rel="stylesheet" type="text/css">
<script language="javascript" src="Menu.js" type="text/javascript"></script>
</head>
<body>
<table class="ParentMenu" id="PrtTable" cellpadding="0" cellspacing="0" border="0" align="center">
<tr>
<td onmouseover="showMenu('HomeTable')" onmouseout="hideMenu('HomeTable')" style="WIDTH: 189px; CURSOR: hand">Home</td>
<td onmouseover="showMenu('PubTable')" onmouseout="hideMenu('PubTable')" style="WIDTH: 211px;CURSOR: hand">Publishers</td>
<td onmouseover="showMenu('ForumTable')" onmouseout="hideMenu('ForumTable')" style="WIDTH: 237px;CURSOR: hand">Forum</td>
<td onmouseover="showMenu('SearchTable')" onmouseout="hideMenu('SearchTable')" style="WIDTH: 156px;CURSOR: hand">Search</td>
<td onmouseover="showMenu('HelpTable')" onmouseout="hideMenu('HelpTable')" style="CURSOR: hand">Help</td>
</tr>
</table>
<table class="ChildMenu" id="HomeTable" onmouseover="showMenu('HomeTable')" onmouseout="hideMenu('HomeTable')"
cellpadding="5" cellspacing="2" border="0" style="LEFT: 10px;" align="center">
<tr>
<td><a href="">Home</a></td>
</tr>
<tr>
<td><a href="">Publishers</a></td>
</tr>
<tr>
<td><a href="">Forum</a></td>
</tr>
<tr>
<td><a href="">Search</a></td>
</tr>
<tr>
<td><a href="">Help</a></td>
</tr>
</table>
<table class="ChildMenu" id="PubTable" onmouseover="showMenu('PubTable')" onmouseout="hideMenu('PubTable')"
cellpadding="5" cellspacing="2" border="0" style="LEFT: 200px;" align="center">
<tr>
<td><a href="">Home</a></td>
</tr>
<tr>
<td><a href="">Publishers</a></td>
</tr>
<tr>
<td><a href="">Forum</a></td>
</tr>
<tr>
<td><a href="">Search</a></td>
</tr>
<tr>
<td><a href="">Help</a></td>
</tr>
</table>
<table class="ChildMenu" id="ForumTable" onmouseover="showMenu('ForumTable')" onmouseout="hideMenu('ForumTable')"
cellpadding="5" cellspacing="2" border="0" style="LEFT: 440px;" align="center">
<tr>
<td><a href="">Home</a></td>
</tr>
<tr>
<td><a href="">Publishers</a></td>
</tr>
<tr>
<td><a href="">Forum</a></td>
</tr>
<tr>
<td><a href="">Search</a></td>
</tr>
<tr>
<td><a href="">Help</a></td>
</tr>
</table>
<table class="ChildMenu" id="SearchTable" onmouseover="showMenu('SearchTable')" onmouseout="hideMenu('SearchTable')"
cellpadding="5" cellspacing="2" border="0" style="LEFT: 650px;" align="center">
<tr>
<td><a href="">Home</a></td>
</tr>
<tr>
<td><a href="">Publishers</a></td>
</tr>
<tr>
<td><a href="">Forum</a></td>
</tr>
<tr>
<td><a href="">Search</a></td>
</tr>
<tr>
<td><a href="">Help</a></td>
</tr>
</table>
<table class="ChildMenu" id="HelpTable" onmouseover="showMenu('HelpTable')" onmouseout="hideMenu('HelpTable')"
cellpadding="5" cellspacing="2" border="0" style="LEFT: 788px;" align="center">
<tr>
<td><a href="">Home</a></td>
</tr>
<tr>
<td><a href="">Publishers</a></td>
</tr>
<tr>
<td><a href="">Forum</a></td>
</tr>
<tr>
<td><a href="">Search</a></td>
</tr>
<tr>
<td><a href="">Help</a></td>
</tr>
</table>
</body>
</html>
No comments:
Post a Comment