type Property

Internet Development Index

Retrieves the type of selection.

Syntax

[ sType = ] selection.type

Possible Values

sTypeString that receives one of the following values.
noneNo selection/insertion point.
textSpecifies a text selection.
controlSpecifies a control selection, which enables dimension controls allowing the selected object to be resized.

The property is read-only. The property has no default value.

Remarks

The selection object is off the document object.

Example

This example uses the type property to create an alert that indicates the type of object selected by the user. If the user clicks the mouse pointer on the text "Some text", the alert reads "Text". If the user clicks the mouse pointer on the space to the right of the text, the alert reads "None".

<BODY onclick="alert(document.selection.type)">
Some text.

Standards Information

This property is defined in World Wide Web Consortium (W3C) Document Object Model (DOM) Level 1 Non-Microsoft link.

Applies To

selection