Share via


mask Behavior

This topic documents a feature of Binary Behaviors, which are obsolete as of Internet Explorer 10.

Grants a masked edit behavior to DHTML Objects.

Syntax

XML
  		N/A
  	</td>
HTML <INPUT STYLE="behavior:url('mask.htc')">
Scripting object.style.behavior = "url('mask.htc')"
object.addBehavior ("mask.htc")

Members Table

The following table lists the members exposed by the mask object.

Property Description
preset Sets or retrieves a preset input mask for the mask behavior.
Event Property Description
onerror Fires when a property is assigned an invalid value, or the property is read-only, for the mask behavior.

Remarks

The behavior-defined members listed in the preceding table are not accessible through script until the window. onload event fires. Waiting for this event to fire ensures that the document is completely loaded, that all behaviors have been applied to corresponding elements on the document , and, consequently, that all the behavior's properties, methods, and events are available for scripting. Attempting to use any of the behavior-defined members will result in a scripting error indicating that the object does not support that particular member.

The mask edit behavior is applied to input elements that allow data entry to provide a combination of restricted input as well as formatted output. When information is entered, visual cues are provided about the type of acceptable information, and feedback about incorrect entries. The behavior can be applied to many common types of forms fields, such as date, time, and phone number fields. These masks can be applied through one of several preset formats.

The mask.htc file can be downloaded from the mask  sample page.

Example

This sample demonstrates the implementation and adjustments of the mask behavior.

<STYLE>
   .mask{behavior: url(/behaviors/mask.htc);}
</STYLE>

<INPUT TYPE = "text" CLASS = "mask">

Code example: https://samples.msdn.microsoft.com/workshop/samples/author/behaviors/library/mask/mask_js.htm

Applies To

INPUT

See Also

Introduction to DHTML Behaviors, Using DHTML Behaviors