共用方式為


UNSELECTABLE attribute

Specifies that an element cannot be selected.

Syntax

HTML
<element UNSELECTABLE="on | off" ... >

 

Property values

  • off
    Permits selection of the element.

  • on
    Prohibits selection of the element.

Standards information

There are no standards that apply here.

Remarks

Note  

Setting the UNSELECTABLE attribute to off does not ensure that an element is selectable. One example is an HTML Application (HTA) with the SELECTION attribute set to no. Elements in the body of the HTA cannot be selected, even if the UNSELECTABLE attribute for an element is set to off.

 

When you click an element with the UNSELECTABLE attribute set to on, any existing current selection is not destroyed.

An element with the UNSELECTABLE attribute set to on can be included in a selection that starts somewhere outside the element.

The UNSELECTABLE attribute is implemented as an expando. Setting the expando property of the document object to false precludes the functionality of all expandos.

Examples

This example shows that the UNSELECTABLE attribute is not inherited by child objects. Text in the TEXTAREA element can be selected and modified, but the text in the parent SPAN element cannot be selected.

<p>
<span id="oSpan" UNSELECTABLE="on" >This text cannot be selected.
<p>
<textarea wrap="physical" rows="5" style="font-weight: bold;" id="oTextarea">
This text can be selected and overwritten.
</textarea>
</p>
This text closes the SPAN and cannot be selected either.
</span>
</p>