listbox element describes a list or table with one or more columns.listhead element describes the header of a listboxlistheader element describes one columns definition in the header of a listboxlistitem element describes one item in a listboxlistcell element describes one cell in an item for a multicolumn listboxlistbox:listbox element and one listitem element for each row.
listbox elementlisthead element to declare the headerslistheader element under the listhead element to declare the unique headerlistitem element for each row
listbox elementlisthead element to declare the headerslistheader element under the listhead element for each column headerlistitem element for each rowlistcell element under the listitem element for each cell
onselect command on the listbox allows to listen to row selection events. For example:<window id="hello" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" > <script> function select() { var index = document.getElementById("theList").currentIndex; print("selected " + index); } </script> <listbox id="theList" onselect="select()"> <listitem label="Ruby"/> <listitem label="Emerald"/> <listitem label="Sapphire" selected="true"/> <listitem label="Diamond"/> </listbox> </window>
<listbox"> <listitem label="Ruby"/> <listitem label="Emerald"/> <listitem label="Sapphire" selected="true"/> <listitem label="Diamond"/> </listbox>The result is:
<listbox id="theList"> <listhead> <listheader label="Color"/> </listhead> <listitem label="Ruby"/> <listitem label="Emerald"/> <listitem label="Sapphire" selected="true"/> <listitem label="Diamond"/> </listbox>The result is:
<listbox id="theList"> <listhead> <listheader label="Name"/> <listheader label="Age"/> <listheader label="City"/> </listhead> <listitem> <listcell label="Julia"/> <listcell label="19"/> <listcell label="Boston"/> </listitem> <listitem> <listcell label="Sandra"/> <listcell label="25"/> <listcell label="London"/> </listitem> <listitem> <listcell label="Sharon"/> <listcell label="35"/> <listcell label="Paris"/> </listitem> </listbox>The result is:
Copyright 2008-2020 Herve Girod. All Rights Reserved. Documentation and source under the LGPL licence