selection
Objects Reference

selection

Description

Represents the active selection, a highlighted block of text and/or other elements in the document upon which a user or a script can carry out some action. You typically use the selection object as input from the user identifying what portion of the document to act on, or as output to the user showing the results of an action.

Remarks

Users and scripts can both create selections. Users create selections by dragging the mouse over a portion of the document. Scripts create them by calling the select method on a text range or similar object. You can retrieve the active selection by applying the selection keyword to the document object. To carry out work on a selection, you can create a text range object from the selection by using the createRange method.

A document can have only one selection at a time. The selection has a type that determines whether it is empty or contains a contiguous block of consecutive text and/or elements. Although an empty selection contains nothing, it is useful for marking a position in the document.

Properties

type

Methods

clear, createRange, empty

Applies To

document


SMALL

Description

Specifies that the enclosed text should be displayed with a relatively smaller font than the current font.

Properties

className, document, id, innerHTML, innerText, isTextEdit, lang, language, offsetHeight, offsetLeft, offsetParent, offsetTop, offsetWidth, outerHTML, outerText, parentElement, parentTextEdit, sourceIndex, style, tagName, title

Methods

click, contains, getAttribute, insertAdjacentHTML, insertAdjacentText, removeAttribute, scrollIntoView, setAttribute

Collections

all, children, filters

Events

onclick, ondblclick, ondragstart, onfilterchange, onhelp, onkeydown, onkeypress, onkeyup, onmousedown, onmousemove, onmouseout, onmouseover, onmouseup, onselectstart

HTML Element

SMALL


SPAN

Description

Specifies an inline text container. This element is especially useful for applying CSS styles.

Properties

className, dataFld, dataFormatAs, dataSrc, document, id, innerText, isTextEdit, lang, language, offsetHeight, offsetLeft, offsetParent, offsetTop, offsetWidth, outerText, parentElement, parentTextEdit, scrollHeight, scrollLeft, scrollTop, scrollWidth, sourceIndex, style, tagName, title

Methods

blur, click, contains, focus, getAttribute, insertAdjacentHTML, insertAdjacentText, removeAttribute, scrollIntoView, setAttribute

Collections

all, children, filters

Events

onblur, onclick, ondblclick, ondragstart, onfilterchange, onfocus, onhelp, onkeydown, onkeypress, onkeyup, onmousedown, onmousemove, onmouseout, onmouseover, onmouseup, onscroll, onselectstart

HTML Element

SPAN


STRIKE

Description

Renders text in strike-through type.

Properties

className, document, id, innerHTML, innerText, isTextEdit, lang, language, offsetHeight, offsetLeft, offsetParent, offsetTop, offsetWidth, outerHTML, outerText, parentElement, parentTextEdit, sourceIndex, style, tagName, title

Methods

click, contains, getAttribute, insertAdjacentHTML, insertAdjacentText, removeAttribute, scrollIntoView, setAttribute

Collections

all, children, filters

Events

onclick, ondblclick, ondragstart, onfilterchange, onhelp, onkeydown, onkeypress, onkeyup, onmousedown, onmousemove, onmouseout, onmouseover, onmouseup, onselectstart

HTML Element

STRIKE

See Also

S


STRONG

Description

Renders text in bold.

Properties

className, document, id, innerHTML, innerText, isTextEdit, lang, language, offsetHeight, offsetLeft, offsetParent, offsetTop, offsetWidth, outerHTML, outerText, parentElement, parentTextEdit, sourceIndex, style, tagName, title

Methods

click, contains, getAttribute, insertAdjacentHTML, insertAdjacentText, removeAttribute, scrollIntoView, setAttribute

Collections

all, children, filters

Events

onclick, ondblclick, ondragstart, onfilterchange, onhelp, onkeydown, onkeypress, onkeyup, onmousedown, onmousemove, onmouseout, onmouseover, onmouseup, onselectstart

HTML Element

STRONG

See Also

ACRONYM, ADDRESS, B, CITE


STYLE

Description

Specifies a style sheet for the page.

Remarks

This element can appear in either HEAD or BODY, but HEAD is the preferred location. Multiple style blocks are permitted.

Properties

className, disabled, document, id, isTextEdit, offsetHeight, offsetLeft, offsetParent, offsetTop, offsetWidth, parentElement, parentTextEdit, readyState, sourceIndex, style, tagName, type

Methods

click, contains, getAttribute, insertAdjacentHTML, insertAdjacentText, scrollIntoView, setAttribute

Events

onerror, onload, onreadystatechange

HTML Element

STYLE


style

Description

Represents the current settings of all possible inline styles for a given element.

Remarks

Inline styles are CSS style assignments that an author applies directly to individual HTML elements using the STYLE= attribute. You use the style object to examine these assignments and either make new assignments or change existing ones.

You can retrieve the style object by applying the style keyword to an element object. You retrieve the current setting for an inline style by applying the corresponding style property to the style object.

The style object does not give access to the style assignments in style sheets. To obtain information about styles in style sheets, you must use the styleSheets collection to gain access to the individual style sheets defined in the document.

Examples

The following example sets the typeface for text in the document body to "Verdana".

document.body.style.fontFamily = "Verdana"

The following example positions the given image at the top of the document.

var i = document.all.tags("IMG");
if (i.length>0) {
    if (i[0].style.position == "absolute")
        i[0].style.top = 0;
}

Properties

background, backgroundAttachment, backgroundColor, backgroundImage, backgroundPosition, backgroundPositionX, backgroundPositionY, backgroundRepeat, border, borderBottom, borderBottomColor, borderBottomStyle, borderBottomWidth, borderColor, borderLeft, borderLeftColor, borderLeftStyle, borderLeftWidth, borderRight, borderRightColor, borderRightStyle, borderRightWidth, borderStyle, borderTop, borderTopColor, borderTopStyle, borderTopWidth, borderWidth, clear, clip, color, cssText, cursor, display, filter, font, fontFamily, fontSize, fontStyle, fontVariant, fontWeight, height, left, letterSpacing, lineHeight, listStyle, listStyleImage, listStylePosition, listStyleType, margin, marginBottom, marginLeft, marginRight, marginTop, overflow, paddingBottom, paddingLeft, paddingRight, paddingTop, pageBreakAfter, pageBreakBefore, pixelHeight, pixelLeft, pixelTop, pixelWidth, posHeight, position, posLeft, posTop, posWidth, styleFloat, textAlign, textDecoration, textDecorationBlink, textDecorationLineThrough, textDecorationNone, textDecorationOverline, textDecorationUnderline, textIndent, textTransform, top, verticalAlign, visibility, width, zIndex

Methods

getAttribute, removeAttribute, setAttribute

Applies To

element object


styleSheet

Description

Represents a single style sheet in the document.

Remarks

You use the object to retrieve information about the style sheet, such as the URL of the source file for the style sheet and the element in the document that owns (defines) the style sheet, and also to modify the style sheet.

You retrieve a style sheet object from the styleSheets collection or from the imports collection. Each item in these collections is a style sheet. A style sheet object is available for a style sheet only if it is included in a document with a STYLE or LINK element, or with an @import statement in a STYLE element.

Properties

disabled, href, id, owningElement, parentStyleSheet, readOnly, type

Methods

addImport, addRule

Collections

imports, rules

Applies To

styleSheets


SUB

Description

Specifies that the enclosed text should be displayed in subscript, using a smaller font than the current font.

Properties

className, document, id, innerHTML, innerText, isTextEdit, lang, language, offsetHeight, offsetLeft, offsetParent, offsetTop, offsetWidth, outerHTML, outerText, parentElement, parentTextEdit, sourceIndex, style, tagName, title

Methods

click, contains, getAttribute, insertAdjacentHTML, insertAdjacentText, removeAttribute, scrollIntoView, setAttribute

Collections

all, children, filters

Events

onclick, ondblclick, ondragstart, onfilterchange, onhelp, onkeydown, onkeypress, onkeyup, onmousedown, onmousemove, onmouseout, onmouseover, onmouseup, onselectstart

HTML Element

SUB

See Also

SUP


SUP

Description

Specifies that the enclosed text should be displayed in superscript and in a smaller font relative to the current font.

Properties

className, document, id, innerHTML, innerText, isTextEdit, lang, offsetHeight, offsetLeft, offsetParent, offsetTop, offsetWidth, outerHTML, outerText, parentElement, parentTextEdit, sourceIndex, style, tagName, title

Methods

click, contains, getAttribute, insertAdjacentHTML, insertAdjacentText, removeAttribute, scrollIntoView, setAttribute

Collections

all, children, filters

Events

onclick, ondblclick, ondragstart, onfilterchange, onhelp, onkeydown, onkeypress, onkeyup, onmousedown, onmousemove, onmouseout, onmouseover, onmouseup, onselectstart

HTML Element

SUP

See Also

SUB


TABLE

Description

Specifies that the contained content is organized into a table with rows and columns.

Remarks

Valid tags within a table include:

This element is a block element. When a document is loading, modifications to a table is restricted until the window.onload event occurs. Read-only access is allowed at anytime.

Properties

align, background, bgColor, border, borderColor, borderColorDark, borderColorLight, cellPadding, cellSpacing, className, clientHeight, clientWidth, cols, dataFld, dataPageSize, dataSrc, document, frame, height, id, innerText, isTextEdit, lang, language, offsetHeight, offsetLeft, offsetParent, offsetTop, offsetWidth, outerText, parentElement, parentTextEdit, rules, scrollHeight, scrollLeft, scrollTop, scrollWidth, sourceIndex, style, tagName, title, width

Methods

blur, click, contains, focus, getAttribute, insertAdjacentHTML, insertAdjacentText, nextPage, previousPage, refresh, removeAttribute, scrollIntoView, setAttribute

Collections

all, children, filters, rows

Events

onafterupdate, onbeforeupdate, onblur, onclick, ondblclick, ondragstart, onfocus, onhelp, onkeydown, onkeypress, onkeyup, onmousedown, onmousemove, onmouseout, onmouseover, onmouseup, onresize, onrowenter, onrowexit, onscroll, onselectstart

HTML Element

TABLE

See Also

TD, TR

© 1997 Microsoft Corporation. All rights reserved. Terms of Use.