SELECTION Attribute | selection Property
Sets or gets a string value that indicates whether the content can be selected with the mouse or keyboard.
Syntax
HTML <HTA:APPLICATION SELECTION = sSelection... > Scripting [ sSelection = ] HTA:APPLICATION.selection
Possible Values
sSelection A String that specifies one of the following values.
- yes
- Default. Content can be selected with the mouse or keyboard.
no
- Content 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.
Set the SELECTION attribute to
no
to prevent the context menu from displaying. If you set the CONTEXTMENU attribute toyes
, it 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 can be selected.
Example
This example shows how to get 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>
Applies To
HTA:APPLICATION
See Also