JavaScript.CoolDev.Com Support Forums
Any questions related to JavaScript menu and JavaScript tree menu by Javascript.CoolDev.Com
| Author |
Message |
italPASTA@takas.lt Guest
|
Posted: Fri Oct 31, 2003 9:30 pm Post subject: The menu [u]doesn't work![/u] help. |
|
|
Sorry for my bad english.
I've downloaded standart COOLjsMenu. And after few customizations, I added it to my webpage as shown in the examples.
This is my "menuitems.js":
| Code: |
var STYLE = {"border":1, "shadow":2, "color":color, "css":css};
//items and formats
var TOP_MENU_ITEMS =
[
{"pos":[10,10], "itemoff":[0,125], "leveloff":[21,0], "style":STYLE,
"size":[22,100]},
{code:"[ BALDAI ]", "format":{"size":[22,120]},
sub:[
{"itemoff":[21,0]},
{code:"Apie gamintoja"},
{code:"Baldu katalogas"},
{code:"Pristatymas"},
{code:"Uzsakymo forma"},
]
},
{code:"[ INFORMACIJA ]", "format":{"size":[22,120]},
sub:[
{"itemoff":[21,0]},
{code:"Naujienos"},
{code:"Kontaktai"},
{code:"Atsiliepimai"},
{code:"Prekyba issimoketinai"},
]
},
{code:"[ KAINORAŠTIS ]", "format":{"size":[22,120]},
sub:[
{"itemoff":[21,0]},
{code:"kainos.zip"},
{code:"kainos.pdf"},
]
},
];
|
And this is what I inserted into page's source code: (head tag)
| Code: | <script type="text/javascript" src="coolmenu.js"></script>
<script type="text/javascript" src="menuitems.js"></script> |
And this is what I inserted into page's source code: (body tag)
| Code: | | <script type="text/javascript">new COOLjsMenu("menu1", TOP_MENU_ITEMS)</script> |
So, after adding these codes, I receive (in IE6) an error, that TOP_MENU_ITEMS is undefined.
Moreover, after a few tries I finally get no error, but unfortunatelly I get a blank space too.
I appreciate your help. |
|
| Back to top |
|
 |
undisclosed Guest
|
Posted: Fri Oct 31, 2003 10:50 pm Post subject: |
|
|
in the page source you need
| Code: | <script type="text/javascript">
var m1 = new COOLjsMenu("menu1", TOP_MENU_ITEMS)
m1.initTop();
</script>
| and at the end of the page, you need | Code: | <script type="text/javascript">
m1.init();
m1.show();
</script> |
and as long as the coolmenu.js and menuitems.js are in the main directory (same as the page you want it displayed on) your fine, if it is in a subdirectory, then you would need to alter the script in the head to match the subdir ie <script type="text/javascript" src="js/coolmenu.js">[/code] |
|
| Back to top |
|
 |
italPASTA@takas.lt Guest
|
Posted: Sat Nov 01, 2003 12:37 am Post subject: Where exactly? |
|
|
Where exactly at the end of the page should I put the above code? Just before </body> tag?
| Code: | <script type="text/javascript">
m1.init();
m1.show();
</script> |
And "in the page source" means the place where I want the menu to be?
| undisclosed wrote: | in the page source you need
| Code: | <script type="text/javascript">
var m1 = new COOLjsMenu("menu1", TOP_MENU_ITEMS)
m1.initTop();
</script>
| and at the end of the page, you need | Code: | <script type="text/javascript">
m1.init();
m1.show();
</script> |
and as long as the coolmenu.js and menuitems.js are in the main directory (same as the page you want it displayed on) your fine, if it is in a subdirectory, then you would need to alter the script in the head to match the subdir ie <script type="text/javascript" src="js/coolmenu.js">[/code] |
|
|
| Back to top |
|
 |
undisclosed Guest
|
Posted: Sat Nov 01, 2003 7:40 am Post subject: |
|
|
<body>
MENU GOES HERE
<script type="text/javascript">
var m1 = new COOLjsMenu("menu1", TOP_MENU_ITEMS)
m1.initTop();
</script>
MENU ENDS HERE
REST OF PAGE
<script type="text/javascript">
m1.init();
m1.show();
</script>
</body> |
|
| Back to top |
|
 |
|
|