Note : The
<LEGEND> element is a new element introduced in HTML 4.0 draft specifications and is only supported by Internet Explorer 4.0 and above.
<LEGEND> element provides a label for the
<FIELDSET> element. For the
<LEGEND> element to be used as the
<FIELDSET> label, it must be the first element contained in the
<LEGEND> accepts the following attributes :
ALIGN attribute specifies where the
<LEGEND> text is located on the
<FIELDSET> border. It can accept vales of
CLASS="Style Sheet class name"
CLASS attribute is used to specify the
<LEGEND> element as using a particular style sheet class. See the Style Sheets topic for details.
ID="Unique element identifier"
ID attribute can be used to either reference a unique style sheet identifier, or to provide a unique name for the
<LEGEND> element for scripting purposes. Any
<LEGEND> element with an
ID attribute can be directly manipulated in script by referencing its
ID attribute, rather than working through the All collection to determine the element. See the Scripting introduction topic for more information.
LANG attribute can be used to specify what language the
<LEGEND> element is using. It accepts any valid ISO standard language abbreviation (for example
"en" for English,
"de" for German etc.) For more details, see the Document Localisation section for more details.
LANGUAGE attribute can be used to expressly specify which scripting language Internet Explorer 4.0 uses to interpret any scripting information used in the
<LEGEND> element. It can accept values of
LANGUAGE attribute is set.
STYLE="In line style setting"
As well as using previously defined style sheet settings, the
<LEGEND> element can have in-line stylings attached to it. See the Style Sheets topic for details.
The Internet Explorer 4.0 (and above) specific
TITLE attribute is used for informational purposes. If present, the value of the
TITLE attribute is presented as a ToolTip when the users mouse hovers over the
For an example of the
<LEGEND> element, see the
<LEGEND> element in a document is an object that can be manipulated through scripting. Note that scripting of the
<LEGEND> element/object is only supported by Internet Explorer 4.0 in its Dynamic HTML object model as Netscape doesn't support the
<LEGEND...> element/object supports all of the standard Dynamic HTML properties (i.e. className, document, id, innerHTML, innerText, isTextEdit, lang, language, offsetHeight, offsetLeft, offsetParent, offsetTop, offsetWidth, outerHTML, outerText, parentElement, parentTextEdit, sourceIndex, style, tagName and title). Details of these can be found in the standard Dynamic HTML properties topics.
<LEGEND> element supports the following properties:
align property directly reflects the value of the
clientHeight property reflects the height (in pixels) of the contents of the
clientWidth property reflects the width (in pixels) of the contents of the
scrollHeight property reflects the contents of the
<LEGEND> elements total scrollable height (in pixels).
scrollLeft property reflects a value representing the distance between the left-most edge of the element and the left-most visible edge of the element. While the contents of the
<LEGEND> element are totally visible on the screen, the
scrollLeft property is 0, only increasing if the left-most edge of the
<LEGEND> elements contents are scrolled off the left hand edge of the current viewing window.
scrollTop property returns a value that represents the distance between the top-most edge of the element and the top-most edge of the current viewing window. When used with the
<LEGEND> element, the
scrollTop property is a value indicative of the extent to which the referenced element has been scrolled vertically. If the contents of the
<LEGEND> element are visible, then the
scrollTop property will be 0, only increasing as the contents of the element are scrolled off the top of the current viewing window.
scrollHeight property, the
scrollWidth property reflects a value that represents the total scrollable width of the contents of the
<LEGEND...> element/object supports all of the standard Dynamic HTML methods (i.e. click, contains, getAttribute, insertAdjacentHTML, insertAdjacentText, removeAttribute, scrollIntoView and setAttribute). Details of these can be found in the standard Dynamic HTML Methods topics.
<LEGEND> element supports the following methods:
blur event can be used to force the users focus away from the referenced
<LEGEND> element, firing the
focus method can be used to pass the users focus to the referenced
<LEGEND> element, forcing the
onfocus event to fire.
<LEGEND...> element/object supports all of the standard Dynamic HTML events (i.e. onclick, ondblclick, ondragstart, onfilterchange, onhelp, onkeydown, onkeypress, onkeyup, onmousedown, onmousemove, onmouseout, onmouseover, onmouseup and onselectstart). Details of these can be found in the standard Dynamic HTML events topics.
<LEGEND> element supports the following events:
When the referenced
<LEGEND> element loses the users focus, the
onblur event is fired. On the fly form validation can make use of the
onblur event to check form elements as the user is entering information.
When the user passes the focus to any
<LEGEND> element, the
onfocus event is fired for that element.
© 1995-1998, Stephen Le Hunte