Quick References
      ADO
      ASP
      CSS2
      HTML
      JavaScript
      Jet SQL
      VBScript
      WML
      WMLScript
      WSH
      XHTML
      XML DOM
      XSLT

Features
      Knowledge Base
      Tutorials

Partners
     ZVON.ORG
     XML
     Planet Source Code
     VisualBuilder
     Web Design
     Your HTML Source
     XML/XSLT Forums
     ASPAlliance
     Scripts
     
     Programmers Heaven
     Tek-Tips Forums
     Developer Fusion
     Code Project











OBJECT:  Text


A Text object provides a field on a form in which the user can enter data and is created with every instance of an HTML <INPUT> tag with the type attribute set to "text". These objects are then stored in the elements array of the parent form and accessed using either the name defined within the HTML tag or an integer (with '0' being the first element defined, in source order, in the specified form).

PROPERTIES

defaultValue Property
This property sets or returns a string indicating the initial value of the Text object. The value of this property initially reflects the value between the start and end <TEXT> tags. Use of the defaultValue property, which can be done at any time, will override the original value.

Syntax: object.defaultValue[ = "newdefaultvalue"]

form Property
This property returns a reference to the parent Form of the Text object.

Syntax: object.form

name Property
This property sets or returns the value of the Text object's name attribute.

Syntax: object.name

type Property
Every element on a form has an associated type property. In the case of a Text object, the value of this property is always "text".

Syntax: object.type

value Property
This property sets or returns the Text object's value attribute. This is the text that is actually displayed in the text field and can be set at any time with any changes being immediately displayed.

Syntax: object.value

METHODS

blur Method
This method removes the focus from the specified Text object.

Syntax: object.blur( )

focus Method
This method gives focus to the specified Text object.

Syntax: object.focus( )

handleEvent Method
This method calls the handler for the specified event.

Syntax: object.handleEvent(event)

select Method
This method is used to select and highlight the entire text that is currently in the input field. When the user starts typing, they will replace whatever is currently there. Used in conjunction with the focus method, this makes it easy to prompt the user for input and places the cursor in the correct place.

Syntax: object.select( )

EVENT HANDLERS

onBlur Event handler
This event handler executes some specified JavaScript code on the occurrence of a blur event (when the Text object loses focus).

Syntax: object.onBlur="myJavaScriptCode"

onChange Event handler
This event handler executes some specified JavaScript code on the occurrence of a change event (when the Text object loses focus and its value has altered).

Syntax: object.onChange="myJavaScriptCode"

onFocus Event handler
This event handler executes some specified JavaScript code on the occurrence of a focus event (when the Text object receives focus).

Syntax: object.onFocus="myJavaScriptCode"

onSelect Event handler
This event handler executes some specified JavaScript code on the occurrence of a select event (when some text in the text field is selected).

Syntax: object.onSelect="myJavaScriptCode"

 


Copyright 1999-2005 by Infinite Software Solutions, Inc. All rights reserved.
Trademark Information