HTML and CSS Reference
In-Depth Information
Table 11.9 Properties of the text Object (continued)
Property
What It Describes
type
The type of the input device; for example, text.
readOnly
Sets or returns whether or not a text field should be read-only.
size
Sets or returns the size of a text field.
tabIndex
Sets or returns the tab order for a text field.
type
Returns the type of form element a text field is.
value
The value attribute that will be assigned whatever the user types in the
textbox.
Table 11.10 Methods of the text Object
Method
What It Describes
blur()
Removes focus away from the object.
focus()
Puts focus on the object.
handleEvent(event)
Invokes the handler for a specified event.
select()
Selects or highlights text in the box.
unwatch()
Turns off the watch for a particular property.
watch()
Watches, and when a property is changed, calls a function.
EXAMPLE 11.17
<html>
<head><title>Text Boxes</title></head>
<body bgcolor="azure">
1
<form name="form1"
id="form1">
Enter your name:<br />
2
<input type="text"
name="namefield"
id="namefield"
size=30 value="Name: "
3
onFocus="document.form1.namefield.select()" />
4
<!-- onFocus="this.select()"> -->
</form>
 
Search WWH ::




Custom Search