INPUT TYPE=text XHTML Element

Send Feedback

The INPUT TYPE=text element creates a single-line text entry control. This is an inline element and does not require a closing tag.

If INPUT is used without a TYPE attribute or with a nonvalid TYPE, it is recognized as INPUT TYPE=text by Internet Explorer Mobile.

Using this Element

There are some common properties and collections that apply to all the elements of the document object model, see Common Properties for All DOM Elements in Internet Explorer Mobile.

This element can be used within a web page with attributes.

This element can be used within scripts where it will have properties, events and methods.

Attributes

Attribute Value PPC SP Description
ACCESSKEY 0...9, #, * Yes Yes Gives access or focus to an active HTML element by using a keypad number.
Note   For Pocket PCs, supported only for devices running Windows Mobile 2003 software or later.
CLASS   Yes Yes Associates the element with a CSS style.
Note   Supported only for devices running Windows Mobile 2003 software or later.
DISABLED   Yes Yes Disables the button so that it appears dimmed and does not respond to user input.
Note   Supported only for devices running Windows Mobile 2003 software or later.
EMPTYOK   Yes Yes Boolean that indicates if leaving the contents of this control empty is acceptable.
FORMAT A, a, N, n, X, x, M, m, *, 0...9 Yes Yes Specifies an input mask for the user input. This conforms to the WML 1.3 specification.

The format mask characters are:

A - Uppercase character

a - Lowercase character

N - Any number character

n - Any numeric, symbol or punctuation character

X - Combination of A and n

x - Combination of a and n

M - Any valid character, default is uppercase

m - Any valid character, default is lowercase

* - Preceeds any of the above formats. Indicates any number of characters of the specified format

0...9 - Proceeds any of the above formats. Indicates a fixed number of the specified format

Example:

<INPUT TYPE="text" NAME="test" FORMAT="NNN">

ID   Yes Yes Uniquely identifies the element within a document.
Note   Supported only for devices running Windows Mobile 2003 software or later
MAXLENGTH 0...# Yes Yes Specifies the text entry control maximum length, in characters.
NAME String Yes Yes Specifies the button control name.
ONBLUR   Yes Yes Event that occurs when the text entry control loses focus by the pointing device or by tabbing navigation.
Note   Supported only for devices running PocketPC 2002 and Smartphone 2002 software or later.
ONCHANGE   Yes Yes Event that occurs when the text entry control loses the input focus and its value has been modified since gaining focus.
Note   Supported only for devices running PocketPC 2002 and Smartphone 2002 software or later.
ONFOCUS   Yes Yes Event that occurs when the text entry control receives focus by a pointing device or by tabbing navigation.
Note   Supported only for devices running PocketPC 2002 and Smartphone 2002 software or later.
STYLE   Yes Yes Provides the definition of the CSS styles used for this element.
Note   Supported only for devices running Windows Mobile 2003 software or later.
TABINDEX   Yes Yes Sets the order in which elements are tabbed to.
Note   Supported only for devices running Windows Mobile 2003 software or later.
VALUE String Yes Yes Specifies the initial value for the text entry control. If the control has a name and a value (set by attribute, script or user input), on forms submission, the name or value pair is submitted to the server.

Scripting Properties

Property Type Access Comments
accessKey string Read/Write  
defaultValue string Read/Write Retrieves the default value (initial contents) of the input type=text control.
disabled boolean Read/Write  
form object Read Only  
maxLength long Read/Write  
name string Read Only  
readOnly boolean Read/Write  
size long Read Only  
type string Read Only Always returns: text
value string Read/Write Sets or retrieves the value of the input type=text control.

Scripting Events

Event Supported Comment
onchange Yes This event fires when the contents of the input type=text have changed and the user commits the change (by leaving the input type=text which has focus).
onblur Yes  
onfocus Yes  

Scripting Methods

Method Support Comments
click Yes syntax:

text.click()

focus Yes syntax:

text.focus()

  • sets focus to the input type=text control.

Requirements

Pocket PC: Windows Mobile 5.0 and later
Smartphone: Windows Mobile 5.0 and later
OS Versions: Windows CE 5.01 and later

See Also

XHTML Elements

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.