text
Summary
The input element with a type attribute whose value is “text” represents a one-line plain text edit control for the input element’s value.
Overview Table
Examples
This example uses the INPUT type=text element to create an empty text control that can contain 15 characters without requiring the user to scroll to read all of the text.
<INPUT TYPE=text VALUE="" NAME="textbox" SIZE=15>
This example uses script to detect the content of the text box and display it in a dialog box.
<SCRIPT>
function detectEntry()
{
alert("Your name is " + textbox.value)
}
</SCRIPT>
Notes
Remarks
The SIZE attribute sets the number of visible characters in the INPUT type=text element. The MAXLENGTH attribute sets the maximum number of characters that can be entered. **Security Warning: **Using this object incorrectly can compromise the security of your application. When submitting text through INPUT type=text over an intranet or the Internet, validating the text string is recommended. For instance, you might validate the string for a restricted set of known, good values (such as letters and numbers) and ignore the rest. You should review the Security Considerations: Dynamic HTML before continuing. Note For more code samples, see Form controls part 1 and Form controls part 2: validation on the Windows Internet Explorer sample site.
Standards information
- HTML 4.01 Specification, Section 17.4
HTML information
{
See also
External resources
http://www.w3.org/TR/html-markup/input.text.html#input.text
Related pages
Reference
- spellcheckspellcheck
input
textArea
Attributions
Microsoft Developer Network: [Windows Internet Explorer API reference Article]