SELECTION Attribute | selection Property

Internet Development Index

Sets or retrieves whether the content can be selected with the mouse or keyboard.

Syntax

HTML<HTA:APPLICATION SELECTION = sSelection... >
Scripting[ sSelection = ] HTA:APPLICATION.selection

Possible Values

sSelectionString that specifies one of the following values.
yesDefault. Content can be selected with the mouse or keyboard.
noContent cannot be selected with the mouse or keyboard.

The property is read-only. The property has a default value of yes.

Remarks

Note  The selection property is read only, however the SELECTION attribute can be used to set the initial value.

Setting the SELECTION attribute to no prevents the context menu from displaying. Setting the CONTEXTMENU attribute to yes has no effect in this case.

Note   The use of content editable elements overrides the selection property. When the contentEditable property is set to true anywhere in an HTML Application (HTA), any object may be selected.

Example

This example shows how to retrieve the selection property.

<HTML>
<HEAD>
<HTA:APPLICATION
ID=oHTA
CONTEXTMENU="yes"
SELECTION="no"/>
<TITLE>HTA Properties</TITLE>
<STYLE>
BODY {font-size: 8pt; font-family: Arial;}
</STYLE>
</HEAD>
<SCRIPT>
function readFun()
{
alert("The selection property is set to:  " + oHTA.selection);
}
</SCRIPT>
<BODY>
<P>Read the property:
<INPUT TYPE="button"  VALUE="Test selection value" onClick="readFun()"/>
</P>
</BODY>
</HTML>

Standards Information

There is no public standard that applies to this property.

Applies To

HTA:APPLICATION

See Also

contentEditable