ManyCodes.com codes & scripts Get free programming codes and tutorials!

28Jul/090

How to get a nice menu with java script on your website

Here is how you can How to get a nice menu with java script on your website.

Put the code below within your site's source code. If you dont know how to implement this code into your site, please goto how to implement the code to your website

Code:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
<!-- this script is from www.manycodes.com -->
<!-- START OF Watermark Navigation Menu DHTML --><!-- START OF Watermark Navigation Menu DHTML -->
 
 
<!-- SUMMARY BRIEF
 
 This DHTML script will make a navigation menu
 that will follow your screen as you scroll,
 kind of like the old Geocities™ watermark.
 
 Look through the code for comments that will
 tell you where to change the code to configure
 it how you want in order to display the links
 that you want.
 
-->
 
 
<!-- Put this code inside of your <HEAD> tag. -->
 
 
<STYLE TYPE="text/css">
<!--
 
.menuheader {
 BORDER-COLOR : #000000 ;
 cursor : hand ;
 Border-Left : #000000 ;
 Border-Top : #000000 ;
 Padding-Left : 1px ;
 Padding-Top : 1px ;
 Background-Color : #000000 ;
}
 
.menu {
 Background-Color : white ;
}
 
.home {
 cursor : hand ;
}
 
.menulinks {
 text-decoration:none;
}
 
//-->
</STYLE>
 
 
<!-- Put this code inside of your <BODY> tag on your page, but OUTSIDE of any other tags. This can NOT be inside of any other tags on your page. -->
 
 
<SCRIPT Language="Javascript1.2">
<!--
 
///////////////////////////////////////////////////////////////
// Change the width and placement of the menu on the page below.
///////////////////////////////////////////////////////////////
 
var menuwidth=110
var offsetleft=10
var offsettop=10
 
var ns4=document.layers?1:0
var ie4=document.all?1:0
var ns6=document.getElementById&&!document.all?1:0
 
function makeStatic() {
if (ie4) {object1.style.pixelTop=document.body.scrollTop+offsettop}
else if (ns6) {document.getElementById("object1").style.top=window.pageYOffset+offsettop}
else if (ns4) {eval(document.object1.top=eval(window.pageYOffset+offsettop));}
setTimeout("makeStatic()",0);
}
 
if (ie4||ns6) {document.write('<span ALIGN="CENTER" ID="object1" STYLE="Position:absolute; Top:20; Left:'+offsetleft+'; Z-Index:5;cursor:hand;background-color:black;"><TABLE BORDER="1" width="'+menuwidth+'" CELLPADDING="0" CELLSPACING="0" BORDERCOLOR="black" bgcolor="white">')}
else if (ns4){ document.write('<LAYER top="20" name="object1" left="'+offsetleft+'" BGCOLOR=black><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="1"><TR><TD><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" width="'+menuwidth+'">')}
 
///////////////////////////////////////////////////////////////
// Change the name of the menu (the text at the top) below.
// You can also shange the font face, size and border colors.
///////////////////////////////////////////////////////////////
 
if (ie4||ns6||ns4)
document.write('<TR><TD BGCOLOR="#3399FF" BORDERCOLORDARK="#99CCFF" BORDERCOLORLIGHT="#003399"><P ALIGN=CENTER><FONT SIZE="4" FACE=ARIAL>Navigation</FONT></TD></TR>')
 
var menui = new Array();
var menul = new Array();
 
///////////////////////////////////////////////////////////////
// Edit menus listing here. You can make as many as you need,
// just make sure that the numbers go up in order correctly.
// The "menui" variables are the actual link text that will
// show up in the menu. The "menul" variables are the URLs
// that match the text displayed there.
///////////////////////////////////////////////////////////////
 
menui[0]="CoffeeCup Software";
menui[1]="CoffeeCup HTML Editor";
menui[2]="CoffeeCup Help Site";
menui[3]="CoffeeCup Site Map";
menui[4]="Other CoffeeCup Products";
menui[5]="Bob & Larry\'s Free Stuff";
menui[6]="About CoffeeCup Software";
menui[7]="Bluedomino Webhosting";
 
 
for (i=0;i<=menui.length-1;i++)
 
///////////////////////////////////////////////////////////////
// You can change table cell background colors below.
// Just change the color names to whatever you want,
// but do NOT change any other code.
///////////////////////////////////////////////////////////////
 
if (ie4||ns6) {document.write('<TR><TD BORDERCOLOR="white" ONCLICK="location=\''+menul[i]+'\'" onmouseover="className=\'menuheader\'" onMouseout="className=\'menu\'"><CENTER><FONT>'+menui[i]+'</FONT></TD></TR>')}
else if (ns4){document.write('<TR><TD BGCOLOR="white"><ILAYER><LAYER width="'+menuwidth+'" onmouseover="bgColor=\'yellow\'" onmouseout="bgColor=\'white\'"><CENTER><A HREF="'+menul[i]+'">'+menui[i]+'</A></CENTER></LAYER></ILAYER></TD></TR>')}
 
if (ie4||ns6) {document.write('</TABLE></span>')}
else if (ns4){document.write('</TABLE></TD></TR></TABLE></LAYER>')}
 
function menu3(){
if (ns6||ie4||ns4)
makeStatic()
}
 
window.onload=menu3
 
//-->
</SCRIPT>
 
 
<!-- END OF Watermark Navigation Menu DHTML -->
 
 
<!-- SUMMARY BRIEF
 
 This DHTML script will make a navigation menu
 that will follow your screen as you scroll,
 kind of like the old Geocities™ watermark.
 
 Look through the code for comments that will
 tell you where to change the code to configure
 it how you want in order to display the links
 that you want.
 
-->
 
 
<!-- Put this code inside of your <HEAD> tag. -->
 
 
<STYLE TYPE="text/css">
<!--
 
.menuheader {
 BORDER-COLOR : #000000 ;
 cursor : hand ;
 Border-Left : #000000 ;
 Border-Top : #000000 ;
 Padding-Left : 1px ;
 Padding-Top : 1px ;
 Background-Color : #000000 ;
}
 
.menu {
 Background-Color : white ;
}
 
.home {
 cursor : hand ;
}
 
.menulinks {
 text-decoration:none;
}
 
//-->
</STYLE>
 
 
<!-- Put this code inside of your <BODY> tag on your page, but OUTSIDE of any other tags. This can NOT be inside of any other tags on your page. -->
 
 
<SCRIPT Language="Javascript1.2">
<!--
 
///////////////////////////////////////////////////////////////
// Change the width and placement of the menu on the page below.
///////////////////////////////////////////////////////////////
 
var menuwidth=110
var offsetleft=10
var offsettop=10
 
var ns4=document.layers?1:0
var ie4=document.all?1:0
var ns6=document.getElementById&&!document.all?1:0
 
function makeStatic() {
if (ie4) {object1.style.pixelTop=document.body.scrollTop+offsettop}
else if (ns6) {document.getElementById("object1").style.top=window.pageYOffset+offsettop}
else if (ns4) {eval(document.object1.top=eval(window.pageYOffset+offsettop));}
setTimeout("makeStatic()",0);
}
 
if (ie4||ns6) {document.write('<span ALIGN="CENTER" ID="object1" STYLE="Position:absolute; Top:20; Left:'+offsetleft+'; Z-Index:5;cursor:hand;background-color:black;"><TABLE BORDER="1" width="'+menuwidth+'" CELLPADDING="0" CELLSPACING="0" BORDERCOLOR="black" bgcolor="white">')}
else if (ns4){ document.write('<LAYER top="20" name="object1" left="'+offsetleft+'" BGCOLOR=black><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="1"><TR><TD><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" width="'+menuwidth+'">')}
 
///////////////////////////////////////////////////////////////
// Change the name of the menu (the text at the top) below.
// You can also shange the font face, size and border colors.
///////////////////////////////////////////////////////////////
 
if (ie4||ns6||ns4)
document.write('<TR><TD BGCOLOR="#3399FF" BORDERCOLORDARK="#99CCFF" BORDERCOLORLIGHT="#003399"><P ALIGN=CENTER><FONT SIZE="4" FACE=ARIAL>Navigation</FONT></TD></TR>')
 
var menui = new Array();
var menul = new Array();
 
///////////////////////////////////////////////////////////////
// Edit menus listing here. You can make as many as you need,
// just make sure that the numbers go up in order correctly.
// The "menui" variables are the actual link text that will
// show up in the menu. The "menul" variables are the URLs
// that match the text displayed there.
///////////////////////////////////////////////////////////////
 
menui[0]="CoffeeCup Software";
menui[1]="CoffeeCup HTML Editor";
menui[2]="CoffeeCup Help Site";
menui[3]="CoffeeCup Site Map";
menui[4]="Other CoffeeCup Products";
menui[5]="Bob & Larry\'s Free Stuff";
menui[6]="About CoffeeCup Software";
menui[7]="Bluedomino Webhosting";
 
 
for (i=0;i<=menui.length-1;i++)
 
///////////////////////////////////////////////////////////////
// You can change table cell background colors below.
// Just change the color names to whatever you want,
// but do NOT change any other code.
///////////////////////////////////////////////////////////////
 
if (ie4||ns6) {document.write('<TR><TD BORDERCOLOR="white" ONCLICK="location=\''+menul[i]+'\'" onmouseover="className=\'menuheader\'" onMouseout="className=\'menu\'"><CENTER><FONT>'+menui[i]+'</FONT></TD></TR>')}
else if (ns4){document.write('<TR><TD BGCOLOR="white"><ILAYER><LAYER width="'+menuwidth+'" onmouseover="bgColor=\'yellow\'" onmouseout="bgColor=\'white\'"><CENTER><A HREF="'+menul[i]+'">'+menui[i]+'</A></CENTER></LAYER></ILAYER></TD></TR>')}
 
if (ie4||ns6) {document.write('</TABLE></span>')}
else if (ns4){document.write('</TABLE></TD></TR></TABLE></LAYER>')}
 
function menu3(){
if (ns6||ie4||ns4)
makeStatic()
}
 
window.onload=menu3
 
//-->
</SCRIPT>
 
 
<!-- END OF Watermark Navigation Menu DHTML -->
 
<font face="Tahoma"><a target="_blank" href="http://www.manycodes.com/"><span style="font-size: 8pt; text-decoration: none">JavaScript Free Code</span></a></font>



Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Webnews
  • Digg
  • del.icio.us
  • StumbleUpon
  • Reddit
  • Ask
  • Facebook
  • Technorati
  • YahooBuzz