JavaScript.CoolDev.Com Support Forums
Any questions related to JavaScript menu and JavaScript tree menu by Javascript.CoolDev.Com
| Author |
Message |
dfluke
Joined: 18 Jun 2003 Posts: 2
|
Posted: Wed Jun 18, 2003 8:04 pm Post subject: newb needs help |
|
|
Thanks in advance to those who help.
I'm having a continuous problem with my code that I can't figure out.
Here's the code for the .js file:
| Code: |
var MENU_ITEMS =
[
Format Definition {"pos":[10,10],"size":[25,100],"itemoff":[0,0],"leveloff":[0,0]}
{code:"Home",
sub:[
// skipping the size, itemoff, and leveloff items. will inherit from parent
{code:'Go Home',url:"blahhome"},
{code:'test2',url:"blah.html"}
]
},
{code:"second menu item",
sub:[
{code: 'submenu1',
sub:[
{code:'submenu of the submenu1'}
]
} //comma needed for additional menus
]
}
];
|
Here is the html code on the html page:
| Code: |
<HTML>
<head>
<script language="JavaScript" src="coolmenu.js"></script>
<script language="JavaScript" src="menu_items.js"></script>
<link href="jscoolmenu.css" rel="stylesheet" type="text/css">
<head/>
<BODY>
<script language="JavaScript">
var dfmenu = new COOLjsMenu("MainMenu", MENU_ITEMS);
</script>
<p>blah</p>
</BODY>
</HTML>
|
Here are the errors:
Line 14
Char 10
Error Expected "]"
and
Line 10
Char 8
Error: 'MENU_ITEMS' is not defined.
I'm super stumped, and I know it's something very simple that I'm missing. Of course, with my very limited knowledge of JavaScript, it could be a major issue and I'm missing something else entirely. Thanks again. |
|
| Back to top |
|
 |
AlexKunin Developer
Joined: 03 Jan 2003 Posts: 1191
|
Posted: Wed Jun 18, 2003 8:35 pm Post subject: |
|
|
To run your menu I've made following modifications:
1. Removed words "Format Definition".
2. Added comma at the end of the same line as in p.1.
3. Added style definition (refer to the code below, first three lines).
4. Added style field to the same line as in p.1.
New menu definition now looks like the following.
| Code: | var color = {"border":"#666666", "shadow":"#DBD8D1", "bgON":"white","bgOVER":"#B6BDD2"};
var css = {"ON":"clsCMOn", "OVER":"clsCMOver"};
var STYLE = {"border":1, "shadow":2, "color":color, "css":css};
var MENU_ITEMS =
[
{"pos":[10,10],"size":[25,100],"itemoff":[0,0],"leveloff":[0,0], "style":STYLE},
{code:"Home",
sub:[
// skipping the size, itemoff, and leveloff items. will inherit from parent
{code:'Go Home',url:"blahhome"},
{code:'test2',url:"blah.html"}
]
},
{code:"second menu item",
sub:[
{code: 'submenu1',
sub:[
{code:'submenu of the submenu1'}
]
} //comma needed for additional menus
]
}
];
|
|
|
| Back to top |
|
 |
dfluke
Joined: 18 Jun 2003 Posts: 2
|
Posted: Thu Jun 19, 2003 1:35 pm Post subject: |
|
|
Wow Thanks!
I guess I copied the wrong version of the code I was previously using. Had I used the correct version, I think the only thing I did wrong was had the words Format Definition. I guess this Javascript course I'm taking soon will help a little with the syntax.
Thank you very much.
Dustin |
|
| Back to top |
|
 |
|
|