dHTML Drop Down Menu Tutorial - Part 2
The JavaScript API
Along with most of the dHTML on this site, this drop-down menu tutorial will make use of the JavaScript API. The API (Application Programming Interface) is a core set of cross-browser JavaScript functions to make dHTML programming quicker and easier.
The API performs tasks such as moving and hiding page elements (DIVs, layers or images) as well as getting and setting their attributes (such as size/position).
The API includes the following functions:
- Basic Browser Sniffing - Not a complete browser sniffer, it only highlights those browsers that can cause problems in the menu system.
- Get Style Object - Returns the Style Object for a given page element.
- Change Object Visibility - Hides or shows an element.
- Find Image (NS4 only) - Used to find image objects in NS4.
- Find object (NS4 only) - Used to find other objects in NS4.
- Get Element Width/Height - Gets the width or height of any page element (not images in NS4).
- Get Element Top/Left - Get the page co-ordinates of any element (not images in NS4).
- Get Image width/Height - Gets the width or height of any image.
- Get Image Top/Left - Get the page co-ordinates of any image.
- Move Element - Sets the x and y co-ordinates of an element.
- Change Style Class - changes the style class of an object (Not NS4 or Opera 5/6).
It's worth taking a few minutes to familiarise yourself with the API. Click here to go to the API section (opens in a new window).
|