Chapter15:InteractiveElements
291
Thecommandelementisonewaytodeineyourmenu’soptions.(Please seeitsentryinthischapterformoredetails.) Example(toolbarmenuwithcommands): <menu type="toolbar"> <li> <menu label="File"> <command label="New" icon="icon/new.png" title="Start a new
drawing" />
<command label="Open" icon="icon/open.png" title="Open a
drawing" />
<command label="Save" icon="icon/save.png" title="Save your drawing" disabled="disabled" /> . . . [more commands] . . . </menu> </li> <li> <menu label="Edit"> . . . [commands for Edit menu] . . . </menu> </li> </menu>
Thisexampleshowsamenuoftype="toolbar"foranimaginarydrawingapp(usingthecanvaselement,forinstance).Itassumestheuser’s browserhasJavaScriptenabled,sinceyoucan’tapplybehaviortocommand elements(orcanvas,forthatmatter)withoutit.Notethatthetypeis speciiedonlyontheparentmenusincethenestedmenusarepartofthe toolbar(amenudoesn’trequirenestedmenus,however).Intheexample, eachnestedmenuisrepresentedintheinterfacebyitslabelattribute (althoughasofthiswriting,nopopularuseragentrendersityet).