Table of contents
- 1. Examples
- 2. Attributes
- 3. Properties
- 4. Methods
- 5. Related
« XUL Reference home [ Examples | Attributes | Properties | Methods | Related ]
A datepicker allows the user to enter a date. Three types are available, which can be specified using the type attribute.
normal- a datepicker with three fields for entering the year, month and date.grid- a datepicker with a calendar grid for selecting a date.popup- a normal datepicker with three fields, but with an additional dropdown button to display a popup grid.
There are several ways to set the selected day. In XUL, the value attribute may be set to a value of the form YYYY-MM-DD to initialize the datepicker to a certain date. If not specified, the datepicker defaults to the current day.
To change the selected date, the value property may be used to set a new value in the form YYYY-MM-DD. The dateValue property may be used to retrieve and set the date using a Date object. In addition, the date, month and year properties may be used to retrieve and modify each component of the date separately.
The change event is fired whenever the date is changed.
A monthchange event is fired for the grid and popup datepickers whenever a new month is navigated to or displayed.
- Properties
- date , dateLeadingZero , dateValue , disabled , month , monthLeadingZero , open , readOnly , tabIndex , value , year , yearLeadingZero
Examples

<datepicker type="grid" value="2007-03-26"/>
Attributes
Inherited from XUL element
align
, allowevents
, allownegativeassertions
, class
, coalesceduplicatearcs
, collapsed
, container
, containment
, context
,
, datasources
, dir
, empty
, equalsize
, flags
, flex
, height
,
, id
, insertafter
, insertbefore
, left
, maxheight
, maxwidth
,
, minheight
, minwidth
, mousethrough
, noinitialfocus
, observes
, ordinal
, orient
, pack
, persist
, popup
, position
, preference-editable
, querytype
, ref
, removeelement
, sortDirection
, sortResource
, sortResource2
, statustext
, style
, template
, tooltip
, tooltiptext
, top
, uri
, wait-cursor
, width
disabled
true the element is disabled. Disabled elements are usually drawn with grayed-out text. If the element is disabled, it does not respond to user actions, it cannot be focused, and the command event will not fire.
disabled
property which, except for menus and menuitems, is normally preferred to use of the attribute, as it may need to update additional state.firstdayofweek
readonly
true, then the user cannot change the value of the element. However, the value may still be modified by a script.tabindex
tab" key. Elements with a higher tabindex are later in the tab sequence. type
type attribute to one of the values below to specify the type of datepicker to usenormalgridpopupvalue
Properties
Inherited Properties
align
,
attributes, allowEvents
,
baseURI, boxObject
, builder
,
childElementCount,
childNodes,
children, className
,
clientHeight,
clientLeft,
clientTop,
clientWidth, collapsed
, contextMenu
, controllers
, database
, datasources
, dir
,
firstChild,
firstElementChild, flex
, height
, hidden
, id
,
lastChild,
lastElementChild, left
,
localName, maxHeight
, maxWidth
, menu
, minHeight
, minWidth
,
namespaceURI,
nextElementSibling,
nextSibling,
nodeName,
nodeType,
nodeValue, observes
, ordinal
, orient
,
ownerDocument, pack
,
parentNode, persist
,
prefix,
previousElementSibling,
previousSibling, ref
, resource
,
scrollHeight,
scrollLeft,
scrollTop,
scrollWidth, statusText
, style
,
tagName,
textContent, tooltip
, tooltipText
, top
, width
date
dateLeadingZero
month
monthLeadingZero
open
readOnly
true, then the user cannot modify the value of the element. year
yearLeadingZero
Methods
Related
- Interfaces
nsIDOMXULControlElement
Mozilla Developer Network