Click to See Complete Forum and Search --> : How to make .js file for cascading menu?


ivo
12-30-2003, 01:17 PM
Hi everyone!

I'm starting to create my own homepage and I want to have the same navigation menu in all of my pages. If sometime I want to change my menu, I would like it to change it once and it would affect all pages with that menu.

Here's what I want to have:

http://javascript.internet.com/navigation/cascading-menu.html#

Correct me if I'm wrong, but if I save my menu in let's say menu.js, then I have to put on every page a code:

<script language="javascript" src="menu.js"></script>

Can somebody tell me how to make such (javascript) file and if there is maybe even better way to solve my little problem?
I'm sure it won't be too hard for any of you :D

Thanks a lot, Ivo.

zachzach
12-30-2003, 01:21 PM
just add ur code(the stuff between the <script> and </script>) tags
in a file named whatever.JS and then on each page just do what you were doingits just like including the text, its not compiled or anything

ivo
12-30-2003, 01:52 PM
Thank you very much for such a fast answer. I did what you suggested, but had to add the following code to my page in order to work properly:

<body marginwidth="0" marginheight="0" style="margin: 0" onLoad="writeMenus()" onResize="if (isNS4) nsResizeHandler()">

<script language="javascript" src="cascading.js"></script>

<style>
<!--

.itemBorder { border: 1px solid black }
.itemText { text-decoration: none; color: #FFFFFF; font: 12px Arial, Helvetica }

.crazyBorder { border: 2px outset #663399 }
.crazyText { text-decoration: none; color: #FFCC99; font: Bold 12px Arial, Helvetica }

-->
</style>
<table bgcolor="#006666" width="100%" border="0" cellpadding="0" cellspacing="0">
<tr><td height="17"><font size="1"> </font></td></tr></table>
</body>


That is in fact the bottom of the code I got from the given url before.
Thanks once again.

Ivo.

P.S.: I found this forum only yesterday :( , but I like it a lot! :D
Happy New Year from Slovenia :)

zachzach
01-02-2004, 09:12 AM
welcome