Availability: |
| |||||||
Inherits from: | Input object | |||||||
JavaScript syntax: | - | myHidden = myDocument.aFormName.anElementName | ||||||
- | myHidden = myDocument.aFormName.elements[anItemIndex] | |||||||
IE | myHidden = myDocument.all.anElementID | |||||||
IE | myHidden = myDocument.all.tags("INPUT")[anIndex] | |||||||
IE | myHidden = myDocument.all[aName] | |||||||
- | myHidden = myDocument.forms[aFormIndex].anElementName | |||||||
- | myHidden = myDocument.forms[aFormIndex].elements[anItemIndex] | |||||||
- | myHidden = myDocument.getElementById(anElementID) | |||||||
- | myHidden = myDocument.getElementsByName(aName)[anIndex] | |||||||
- | myHidden = myDocument.getElementsByTagName("INPUT")[anIndex] | |||||||
HTML syntax: | <INPUT TYPE="hidden"> | |||||||
Argument list: | anIndex | A valid reference to an item in the collection | ||||||
aName | The NAME attribute of an element | |||||||
anElementID | The ID attribute of an element | |||||||
anItemIndex | A valid reference to an item in the collection | |||||||
aFormIndex | A reference to a particular form in the forms collection | |||||||
Object properties: | type, value | |||||||
Event handlers: | onAfterUpdate, onBeforeUpdate, onHelp, onRowEnter, onRowExit |
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 Hidden 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 hidden field. In actual fact, the object is represented as an item of the Input object class.
Hidden objects don't respond to any events. They can't since they are not visible and therefore the user cannot interact with them to trigger one.
They may be accessed by event handling functions associated with the Form object but very little else.
Unlike MSIE, Netscape does not support the defaultValue property for this sub-class of the Input object. It also does not support the onFocus event, although why MSIE should support focus control onto a Hidden object is not clear.
<HTML> <HEAD> </HEAD> <BODY> <DIV ID="RESULT">?</DIV> <FORM> <INPUT TYPE="hidden" VALUE="A" NAME="BOX_A"> <INPUT TYPE="hidden" VALUE="B" NAME="BOX_B"> <INPUT TYPE="hidden" VALUE="C" NAME="BOX_C"> <INPUT TYPE="hidden" VALUE="D" NAME="BOX_D"> <INPUT TYPE="button" VALUE="Reveal" onClick="handleClick()"> </FORM> <SCRIPT> function handleClick() { myString = "["; myString += document.forms[0].BOX_A.value; myString += "] ["; myString += document.forms[0].BOX_B.value; myString += "] ["; myString += document.forms[0].BOX_C.value; myString += "] ["; myString += document.forms[0].BOX_D.value; myString += "]"; document.all.RESULT.innerText = myString; } </SCRIPT> </BODY> </HTML>
See also: | Element object, Form.elements[], Input object |
Property | JavaScript | JScript | N | IE | Opera | NES | ECMA | DOM | CSS | HTML | Notes |
---|---|---|---|---|---|---|---|---|---|---|---|
type | 1.1 ![]() | 3.0 ![]() | 3.0 ![]() | 4.0 ![]() | 3.0 ![]() | ![]() | ![]() | 1 ![]() | ![]() | ![]() | ReadOnly. |
value | 1.0 ![]() | 1.0 ![]() | 2.0 ![]() | 3.02 ![]() | 3.0 ![]() | ![]() | ![]() | 1 ![]() | ![]() | ![]() | - |
Event name | JavaScript | JScript | N | IE | Opera | NES | ECMA | DOM | CSS | HTML | Notes |
---|---|---|---|---|---|---|---|---|---|---|---|
onAfterUpdate | ![]() | 3.0 ![]() | ![]() | 4.0 ![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() | - |
onBeforeUpdate | ![]() | 3.0 ![]() | ![]() | 4.0 ![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() | - |
onHelp | ![]() | 3.0 ![]() | ![]() | 4.0 ![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
onRowEnter | ![]() | 3.0 ![]() | ![]() | 4.0 ![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() | - |
onRowExit | ![]() | 3.0 ![]() | ![]() | 4.0 ![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() | - |
Prev | Home | Next |
Hexadecimal value | Up | Hidden.type |
JavaScript Programmer's Reference, Cliff Wootton Wrox Press (www.wrox.com) Join the Wrox JavaScript forum at p2p.wrox.com Please report problems to support@wrox.com © 2001 Wrox Press. All Rights Reserved. Terms and conditions. |