HTML Elements
Creates a single-line text entry control. | HTML 2, 3.2, 4, 4.01, 5 |
HTML Syntax
<input
accesskey = key
autocomplete = on | off
class = classname
datafld = fieldname
dataformatas = html | text
datasrc = #id
dir = ltr | rtl
disabled
id = value
maxlength = n
name = name
readonly
size = n
style = css properties
tabindex = n
title = text
type = text
value = value
vcard_name = vcard
event = script
>
Use this in conjunction with the size and maxLength properties.
INPUT Members
The following example displays an empty text control that can contain 15 characters without scrolling.
<input type=text id="txtName" name="txtName" size=15>
The following script detects the contents of the text box and displays it in a dialog box.
<script language="JavaScript">
function detectEntry ( ) {
alert ( "Hello " + txtName.value + ". Welcome to DHTML." );
}
</script>
The preceding HTML and script are implemented below. Click the button to call the function.
Enter your name:
INPUT TEXTAREA