Adobe 38043740 - ColdFusion Standard - Mac Development Manual page 822

Developing applications
Hide thumbs Also See for 38043740 - ColdFusion Standard - Mac:
Table of Contents

Advertisement

DEVELOPING COLDFUSION 9 APPLICATIONS
Requesting and Presenting Information
The following example shows a simple horizontal menu with submenus that uses JavaScript to change the display
contents. When the user selects an end item in a menu, the text in the
selected menu.
<html>
<head>
</head>
<body>
<!--- The selected function changes the text in the selectedItemLabel div block to show the
selected item. --->
<script type="text/javascript">
function selected(item) {
var el = document.getElementById("selectedItemLabel");
el.innerHTML = "You selected: " + item;
}
</script>
<!--- A horizontal menu with nested submenus. Clicking an end item calls the selected
function. --->
<cfmenu name="hmenu" bgcolor="##9999ff" selectedfontcolor="##0000dd"
selecteditemcolor="##ddddff">
<cfmenuitem display="Home" href="javascript:selected('Home');" />
<cfmenuitem display="File">
<cfmenuitem display="Open...">
<cfmenuitem display="Template" href="javascript:selected('File &gt;
Open... &gt; Template');" />
<cfmenuitem divider="true" />
<cfmenuitem display="CSS" href="javascript:selected('File &gt; Open... &gt;
CSS');" />
</cfmenuitem>
<cfmenuitem display="Close" href="javascript:selected('File &gt; Close');" />
</cfmenuitem>
<cfmenuitem display="Help">
<cfmenuitem display="About" href="javascript:selected('Help &gt; About');" />
</cfmenuitem>
</cfmenu>
<!--- A div with initial text.
The selected function changes the text by resetting the innerHTML. --->
<div style=" margin-top: 100; margin-left: 10;"><span id="selectedItemLabel">
Please select an item!</span></div>
</body>
</html>
Styling menus
The cfmenu and cfmenuitem tags have several attributes that let you easily control the menu appearance. These
attributes consist of two types: basic and CSS style. Basic attributes, such as the
control individual menu characteristics. CSS style attributes let you specify a CSS style specification for a whole menu
or part of a menu. The following information describes how the CSS style specifications interact and affect the menu
style. For descriptions of all style-related attributes, see the cfmenu and cfmenuitem descriptions in the CFML
Reference.
div
Last updated 1/20/2012
block below the menu shows the path to the
tag
cfmenu
fontColor
817
attribute,

Advertisement

Table of Contents
loading

This manual is also suitable for:

Coldfusion 9

Table of Contents