type property

Retrieves the type of selection.

Syntax

JavaScript

p = object.type

Property values

Type: String

None

No selection/insertion point.

Text

Specifies a text selection.

Control

Specifies a control selection, which enables dimension controls allowing the selected object to be resized.

Remarks

selection is a child object of the document object.

Examples

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.
</body>

See also

selection

 

 

Show:
© 2014 Microsoft. All rights reserved.