Text Object
CSGNetwork FREE Source Code, Javascript Source, and Code Snippets!
CSGNetwork Custom Search
     Bookmark and Share
 
CSGNetwork
Snippets
Calculators
Top Free Apps
Home
Back



Right click this window and select "view source" in order to copy the source for this script.

Text Object

Text fields (<input type="text">) within your form can be accessed and manipulated using JavaScript, via the corresponding Text object. To access a text field in JavaScript, use the syntax:

document.myform.mytextfield //where mytextfield is the name of the field
document.myform.elements[i] //where i is the position of the text field within form

Events

Events Description
onBlur Code is executed when the focus is removed from the text field.
onChange Code is executed when the user changes the value within the text field, and removes focus away from the field.
onFocus Code is executed when the focus is set on the text field.
onKeyDown Code is executed when user presses down the key within the text field.
onKeyPress Code is executed when user presses the key within the text field.
onKeyUp Code is executed when user releases a key within the text field.
onSelect Code is executed when user selects some text within the text field.

Properties

Properties Description
accessKey String value that sets/ returns the accessKey for the field.
disabled Boolean value that sets/ returns whether the field is disabled.
form References the form that contains the text field.
name Reflects the name of the text field (the name attribute).
type A property available on all form elements, "type" returns the type of the calling form element, in this case, "text".
value Read/write string that specifies the value of the text field.

Methods

Methods Description
blur() Removes focus away from the text field.
focus() Sets focus on the text field.
select() Highlights the content of the text field.


Bookmark and Share
Registered® Trademark™ and Copyright© 1973 - CSG, Computer Support Group, Inc. and CSGNetwork.Com All Rights Reserved