DHTML Lab: HierMenus CENTRAL: FAQ #2 - dhtmlab.com | WebReference

DHTML Lab: HierMenus CENTRAL: FAQ #2 - dhtmlab.com

Frequently Asked Question #2

The Hierarchical Menus script item display is text-based. Occasionally, I need to include an image as part of an item. Could you please include this functionality in a future release?

Although it was never isolated as a feature of the script, it has always been possible (since version 1.0) to include images in menu items.

The item display text in the arrays is inserted into the menu item as HTML, not plain text. Therefore, any HTML included as part of the item display text will be rendered correctly. Simple, non-conflicting, HTML, that is. Images are fine, but keep other HTML to a minimum.

Example:

Let's say we have these three corporate images to be used in a menu, with links to their home page:


WebReference
WR.gif


Netscape
NS.gif


Microsoft
IE.gif

Our menu array would look like this:

HMArray1 = [
[],
["<IMG SRC='WR.gif' WIDTH=39 HEIGHT=30 BORDER=0 ALIGN=ABSMIDDLE>&nbsp;WebReference","http://www.webreference.com/",1,0,0],
["<IMG SRC='NS.gif' WIDTH=39 HEIGHT=30 BORDER=0 ALIGN=ABSMIDDLE>&nbsp;Netscape","http://www.netscape.com/",1,0,0],
["<IMG SRC='IE.gif' WIDTH=39 HEIGHT=30 BORDER=0 ALIGN=ABSMIDDLE>&nbsp;Microsoft","http://www.microsoft.com/",1,0,0]
]

The resulting menu would look like this (assuming you have set the color scheme and other parameters):



Produced by Peter Belesis and

All Rights Reserved. Legal Notices.
Created: June 26, 2001
Revised: June 26, 2001

URL: http://www.webreference.com/dhtml/hiermenus/faq/faq2.html

Justtechjobs.comFind a programming school near you






Online Campus Both