|
OverviewThere are three steps in creating a menu.
Finally, there is a section that does trouble shooting menu display problems 1. Creating a MenuYou can use the Menu Builder to build the menu if you just want a general purpose menu, or you could use the following format to add nodes to a menu. <script type="text/javascript"><!-- var myMenu = [ ['icon', 'title', 'url', 'target', 'description'], // a menu item ['icon', 'title', 'url', 'target', 'description'], // a menu item _cmSplit, ['icon', 'title', 'url', 'target', 'description', // a folder item ['icon', 'title', 'url', 'target', 'description'], // a menu item _cmSplit, ['icon', 'title', 'url', 'target', 'description'], // a menu item ['icon', 'title', 'url', 'target', 'description', // a folder item ['icon', 'title', 'url', 'target', 'description'], // a menu item ['icon', 'title', 'url', 'target', 'description'] // a menu item ] ] ]; --></script> To use a horizontal/vertical menu split, simply put A folder item contains sub menus. Note that sub menus can be nested. Also, JSCookMenu allows a folder item to contain links. Be careful of the commas. If you missed one between two sibling nodes, both IE and Netscape simply quit parsing the rest. So, if you do not see the menu, this is one place to check. 2. Pick a ThemeIn order to use JSCookMenu, one needs to define a set of styles for HTML components. Usually, this task is not easy to do from scratch. Fortunately, some themes were provided and can be used as a template. Currently, I designed 4 themes:
The guide line for definiting new themes will be described separately. Right now, you can just pick a theme, for instance, Office XP. To load a theme, one needs to do the following: <script type="text/javascript" src="/JSCookMenu/JSCookMenu.js"></script> Then <link rel="stylesheet" href="/JSCookMenu/ThemeOffice/theme.css" type="text/css"> <script type="text/javascript" src="/JSCookMenu/ThemeOffice/theme.js"></script> It is very important that It is also important to have include 3. Display the MenuFirst, one needs to find the place to put the menu. JSCookMenu can be assigned to
TD, SPAN, DIV as well as other type of HTML elements that have <div id="myMenuID"></div> Then, add a java script command that tells the web browser to display the menu in that element: <script type="text/javascript"><!-- cmDraw ('myMenuID', myMenu, 'hbr', cmThemeOffice); --></script> The first parameter is the HTML element id, the second one is the menu tree. Congratulations, you just built the first menu. It does not look very pretty at present since no real interesting stuff has been inserted. The border around the main menu was purposely not there since it could be added at any time. Check the demo page for some fancier examples. 4. Trouble ShootingThere are many reasons for not showing the menus.
|
|