type property
Retrieves the type of selection.
Syntax
| JavaScript | |
|---|
Property values
Type: String
-
No selection/insertion point.
-
Specifies a text selection.
-
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
Show: