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.


HTML <INPUT STYLE="behavior:url('')">
Scripting object .style.behavior = "url('')"
object .addBehavior ("")

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.


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 file can be downloaded from the mask  sample page.


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

   .mask{behavior: url(/behaviors/;}

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

Code example:

Applies To


See Also

Community Additions