0321699742_The_HTML_Pocket_Guide

Page 302

Chapter฀15:฀฀Interactive฀Elements฀

291

The฀command฀element฀is฀one฀way฀to฀deine฀your฀menu’s฀options.฀(Please฀ see฀its฀entry฀in฀this฀chapter฀for฀more฀details.) Example฀(toolbar฀menu฀with฀commands): <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>

This฀example฀shows฀a฀menu฀of฀type="toolbar"฀for฀an฀imaginary฀drawing฀app฀(using฀the฀canvas฀element,฀for฀instance).฀It฀assumes฀the฀user’s฀ browser฀has฀JavaScript฀enabled,฀since฀you฀can’t฀apply฀behavior฀to฀command฀ elements฀(or฀canvas,฀for฀that฀matter)฀without฀it.฀Note฀that฀the฀type฀is฀ speciied฀only฀on฀the฀parent฀menu฀since฀the฀nested฀menus฀are฀part฀of฀the฀ toolbar฀(a฀menu฀doesn’t฀require฀nested฀menus,฀however).฀In฀the฀example,฀ each฀nested฀menu฀is฀represented฀in฀the฀interface฀by฀its฀label฀attribute฀ (although฀as฀of฀this฀writing,฀no฀popular฀user฀agent฀renders฀it฀yet).


Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.