|
Object Oriented Menu Bar! (Saves Time!)
Okay, the menu bar may not be for beginners, but for the
advanced users, it sure should save a lot of time!
What type of code is involved in adding this menu to your web page?
- First, add an include statement for the script
in between the open and close HEAD tags.
<SCRIPT language="JScript"
src="OOMenu.js"></SCRIPT>
- Next, create an instance of the menu bar
object. The argument (60) in this case is the desired minimum
width in pixels of the menu buttons.
var MenuBar = new js_MenuBar(60);
- Create a javascript function
on your page to create the menu on page load.
function createMenu( argTable ) { }
- In the
createMenu function, create the menu buttons for your menu
bar.
MenuBar.Add( "About", "Select
a menu option", "Click a menu option below to learn about
this Object Oriented menu", null ); MenuBar.Add( "Copyright",
"Notes on the copyright", "Notes on the
copyright", null ); MenuBar.AddSpacer( 60 ); MenuBar.Add( "Vote",
null, null, vote );
- Now add menu items to the menus you just
created.
MenuBar.AddItemToMenu( 0, "Code", null,
"What code is involved in creating this menu?", null
); MenuBar.AddItemSpacer( 0 ); MenuBar.AddItemToMenu( 0,
"Creation", null, "About the creation of this
code", null ); MenuBar.AddItemToMenu( 1, "Notice", null,
"Copyright restrictions notice", null
); MenuBar.AddItemToMenu( 3, "At_PSC", "Click here",
"Give this code a good vote!", vote );
- Now call the method to create
the menu.
MenuBar.Build( argTable );
- Dont forget to add a blank table (see source)
and add the create function to the onLoad event of the body.
onLoad="createMenu( document.all.mainMenu );"
This code was created by Philip Dearmore originally to be used with
the WebTrack ( www.asptools.biz) Time
Tracking web application. It is released as freeware to any one for
their own personal use, provided the copyright conditions are met.
Please view the copyright conditions to see how to use this
code in your application. This code may not be used in whole or
part in any commercial or packaged web application. See my website
for details on obtaining a license to do this.
The code found in OOMenu.js and all of the supporting HTML files is
copyright of Philip Dearmore (2003) All Rights Reserved. This code
is distributed as freeware, and you are free to use it on your
personal web page. Any other uses including, but not limited
to commercial web sites, packaged web applications, free or
commercial components in ASP, JS, or HTML, etc., must obtain a
license. Please visit the ASPTools.Biz web site for licensing
information at www.asptools.biz.
|