Home > Element Reference : Popup

Contents

### Popup

A container that appears in a child window. The popup window does not have any special frame. Popups can be displayed when an element is clicked by assigning the id of the popup to either the popup, context or tooltip attribute of the element. A popup is a type of box that defaults to vertical orientation.

More information about Popup

#### Attributes:

Attributes inherited from XUL Element

onpopuphidden

This event is sent to a popup after it has been hidden.

onpopuphiding

This event is sent to a popup when it is about to be hidden.

onpopupshowing

This event is sent to a popup just before it is popped open. This handler is usually used to dynamically set the contents when the user requests to display it.

onpopupshown

This is event is sent to a popup after it has been opened, much like the onload event is sent to a window when it is opened.

position

The position attribute determines where the popup appears relative to the element the user clicked to invoke the popup.

- after_start: The popup appears underneath the element with the popup's upper-left corner aligned with the lower-left corner of the element. The left edges of the element and the popup are aligned.
- after_end: The popup appears underneath the element with the popup's upper-right corner aligned with the lower-right corner of the element. The right edges of the element and the popup are aligned.
- before_start: The popup appears above the element with the popup's lower-left corner aligned with the upper-left corner of the element. The left edges of the element and the popup are aligned.
- before_end: The popup appears above the element with the popup's lower-right corner aligned with the upper-right corner of the element. The right edges of the element and the popup are aligned.
- end_after: The popup appears to the right of the element with the popup's lower-left corner aligned with the lower-right corner of the element. The bottom edges of the element and the popup are aligned.
- end_before: The popup appears to the right of the element with the popup's upper-left corner aligned with the upper-right corner of the element. The top edges of the element and the popup are aligned.
- start_after: The popup appears to the left of the element with the popup's lower-right corner aligned with the lower-left corner of the element. The bottom edges of the element and the popup are aligned.
- start_before: The popup appears to the left of the element with the popup's upper-right corner aligned with the upper-left corner of the element. The top edges of the element and the popup are aligned.
- overlap: The popup appears over top of the element with the upper-left corners aligned.
- at_pointer: The popup appears at the same position as the mouse pointer.
- after_pointer: The popup appears at the same horizontal position as the mouse pointer, but vertically, it is placed just below the element. This is the value used for tooltips.

#### Properties and Methods:

Properties and Methods inherited from XUL Element

activeChild

The currently active item within the popup. You can modify this value to select a particular item.

autoPosition Moz0.9.5
enableKeyboardNavigator ( enable ) Moz0.9.5

enableRollup ( enable ) Moz0.9.5

hidePopup ( )

Closes the popup window immediately.

moveTo ( x , y ) Moz0.9.5

Moves the popup to a new location.

openPopup ( element, x , y , popupType, anchor, align )

Opens a popup window at the position (x,y) relative to the element. Type should be either the string "popup", "context" or "tooltip". The parameter anchor corresponds to the popupanchor attribute on the element. The parameter align corresponds to the popupalign attribute on the element.

popup.openPopup (someButton,0,0,"popup","bottomleft","topleft");

This example will open the popup anchored on the bottom-left corner of the button someButton.

popupBoxObject Moz0.9.5

This read-only property holds the nsIPopupBoxObject that implements the popup.

sizeTo ( width , height ) Moz0.9.5

Changes the current size of the popup to a new width and height.

Copyright (C) 1999 - 2002 XULPlanet.com