TextCell object (Object/DOM)

A single line text cell in a form.

Availability:

DOM level - 1
JavaScript - 1.0
JScript - 1.0
Internet Explorer - 3.02
Netscape - 2.0
Opera - 3.0
Inherits from:Input object
JavaScript syntax:-myTextCell = myDocument.aFormName.anElementName
-myTextCell = myDocument.aFormName.elements[anItemIndex]
IEmyTextCell = myDocument.all.anElementID
IEmyTextCell = myDocument.all.tags("INPUT")[anIndex]
IEmyTextCell = myDocument.all[aName]
-myTextCell = myDocument.forms[aFormIndex].anElementName
-myTextCell = myDocument.forms[aFormIndex].elements[anItemIndex]
-myTextCell = myDocument.getElementById(anElementID)
-myTextCell = myDocument.getElementsByName(aName)[anIndex]
-myTextCell = myDocument.getElementsByTagName("INPUT")[anIndex]
HTML syntax:<INPUT TYPE="text">
Argument list:anIndexA valid reference to an item in the collection
aNameThe NAME attribute of an element
anElementIDThe ID attribute of an element
anItemIndexA valid reference to an item in the collection
aFormIndexA reference to a particular form in the forms collection
Object properties:maxLength, readOnly, size, type, value
Object methods:handleEvent(), select()
Event handlers:onAfterUpdate, onBeforeUpdate, onBlur, onChange, onFilterChange, onFocus, onHelp, onKeyDown, onKeyPress, onKeyUp, onMouseDown, onMouseMove, onMouseOut, onMouseOver, onMouseUp, onRowEnter, onRowExit, onSelect

Many properties, methods and event handlers are inherited from the Input object class. Refer to topics grouped with the "Input" prefix for details of common functionality across all sub-classes of the Input object super-class.

There isn't really a TextCell object class, but it is helpful when trying to understand the wide variety of input element types if we can reduce the complexity by discussing only the properties and methods of a text cell. In actual fact, the object is represented as an item of the Input object class.

Event handling support via properties containing function objects was added to TextCell objects at version 1.1 of JavaScript.

The Netscape implementation of this sub-class of the Input object does not support as wide a variety of events as the MSIE implementation. In particular, the keyboard events are not supported.

The WebTV set-top box does not support the onkeypress event handler for this object type prior to the Summer 2000 release.

Example code:

   <HTML>
   <HEAD>
   </HEAD>
   <BODY>
   <DIV ID="RESULT">?</DIV>
   <FORM>
   <INPUT TYPE="text" VALUE="" NAME="BOX_A"><BR>
   <INPUT TYPE="text" VALUE="" NAME="BOX_B"><BR>
   <INPUT TYPE="text" VALUE="" NAME="BOX_C"><BR>
   <INPUT TYPE="text" VALUE="" NAME="BOX_D"><BR><BR>
   <INPUT TYPE="button" VALUE="Reveal" onClick="handleClick()">
   </FORM>
   <SCRIPT>
   function handleClick()
   {
      myString  = "[";
      myString += document.forms[0].elements.BOX_A.value;
      myString += "] [";
      myString += document.forms[0].elements.BOX_B.value;
      myString += "] [";
      myString += document.forms[0].elements.BOX_C.value;
      myString += "] [";
      myString += document.forms[0].elements.BOX_D.value;
      myString += "]";
      document.all.RESULT.innerText = myString;
   }
   </SCRIPT>
   </BODY>
   </HTML>

See also:Element object, Element.isTextEdit, Form.elements[], FormElement object, Input object, Input.accessKey, JellyScript, onChange, onKeyDown, onKeyPress, onKeyUp, TextCell.handleEvent(), TextRange object

PropertyJavaScriptJScriptNIEOperaNESECMADOMCSSHTMLNotes
maxLength n/a3.0 3.0 n/a4.0 4.0 n/a n/a n/a n/a n/a n/a-
readOnly n/a3.0 3.0 n/a4.0 4.0 n/a n/a n/a n/a n/a n/aReadOnly.
size n/a3.0 3.0 n/a4.0 4.0 n/a n/a n/a n/a n/a n/aWarning
type1.1 1.13.0 3.03.0 3.04.0 4.03.0 3.0 n/a n/a1 1 n/a n/aReadOnly.
value1.0 1.01.0 1.02.0 2.03.02 3.023.0 3.0 n/a n/a1 1 n/a n/a-

MethodJavaScriptJScriptNIEOperaNESECMADOMCSSHTMLNotes
handleEvent()1.2 1.2 n/a4.0 4.0 n/a n/a n/a n/a n/a n/a n/a-
select()1.0 1.01.0 1.02.0 2.03.02 3.023.0 3.0 n/a n/a1 1 n/a n/a-

Event nameJavaScriptJScriptNIEOperaNESECMADOMCSSHTMLNotes
onAfterUpdate n/a3.0 3.0 n/a4.0 4.0 n/a n/a n/a n/a n/a n/a-
onBeforeUpdate n/a3.0 3.0 n/a4.0 4.0 n/a n/a n/a n/a n/a n/a-
onBlur1.1 1.13.0 3.03.0 3.04.0 4.03.0 3.0 n/a n/a n/a n/a n/aWarning
onChange1.0 1.03.0 3.02.0 2.04.0 4.03.0 3.0 n/a n/a n/a n/a n/a-
onFilterChange n/a3.0 3.0 n/a4.0 4.0 n/a n/a n/a n/a n/a n/a-
onFocus1.0 1.03.0 3.02.0 2.04.0 4.03.0 3.0 n/a n/a n/a n/a n/aWarning
onHelp n/a3.0 3.0 n/a4.0 4.0 n/a n/a n/a n/a n/a n/aWarning
onKeyDown1.2 1.23.0 3.04.0 4.04.0 4.03.0 3.0 n/a n/a n/a n/a4.0 4.0Warning
onKeyPress1.2 1.23.0 3.04.0 4.04.0 4.03.0 3.0 n/a n/a n/a n/a4.0 4.0Warning
onKeyUp1.2 1.23.0 3.04.0 4.04.0 4.03.0 3.0 n/a n/a n/a n/a4.0 4.0Warning
onMouseDown1.2 1.23.0 3.04.0 4.04.0 4.03.0 3.0 n/a n/a n/a n/a4.0 4.0Warning
onMouseMove1.2 1.23.0 3.04.0 4.04.0 4.0 n/a n/a n/a n/a n/a4.0 4.0Warning
onMouseOut1.1 1.13.0 3.03.0 3.04.0 4.03.0 3.0 n/a n/a n/a n/a4.0 4.0Warning
onMouseOver1.0 1.01.0 1.02.0 2.03.02 3.023.0 3.0 n/a n/a n/a n/a4.0 4.0Warning
onMouseUp1.2 1.23.0 3.04.0 4.04.0 4.03.0 3.0 n/a n/a n/a n/a4.0 4.0Warning
onRowEnter n/a3.0 3.0 n/a4.0 4.0 n/a n/a n/a n/a n/a n/a-
onRowExit n/a3.0 3.0 n/a4.0 4.0 n/a n/a n/a n/a n/a n/a-
onSelect1.0 1.03.0 3.02.0 2.04.0 4.03.0 3.0 n/a n/a n/a n/a n/a-

Inheritance chain:

Element object, Input object, Node object