DHTML Lab: HierMenus CENTRAL: Version 3.x FAQ #4 - dhtmlab.com | WebReference

DHTML Lab: HierMenus CENTRAL: Version 3.x FAQ #4 - dhtmlab.com

Frequently Asked Question #4

Entered: Feb 15, 1999


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:

arMenu1 = new Array(
"",
"","",
"","",
"","",
"","",
"<IMG SRC='WR.gif' WIDTH=39 HEIGHT=30 BORDER=0 ALIGN=ABSMIDDLE>&nbsp;WebReference","https://www.webreference.com/",0,
"<IMG SRC='NS.gif' WIDTH=39 HEIGHT=30 BORDER=0 ALIGN=ABSMIDDLE>&nbsp;Netscape","https://www.netscape.com/",0,
"<IMG SRC='IE.gif' WIDTH=39 HEIGHT=30 BORDER=0 ALIGN=ABSMIDDLE>&nbsp;Microsoft","https://www.microsoft.com/",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: Dec 29, 1998
Revised: June 26, 2001

URL: https://www.webreference.com/dhtml/hiermenus/version3/faq/faq4.html

Justtechjobs.comFind a programming school near you






Online Campus Both