A Hidden object provides a text object on a form that is hidden from the user and is created with every instance of an HTML <INPUT> tag with the type attribute set to 'hidden'. A Hidden object is used to pass name/value pairs when the form is submitted. 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).
<form action="" method="POST" id="myForm">
<input type="Hidden" name="objHidden" value="" id="objHidden">
<input type="Button" name="" value="Get hidden value" id="myButton"
onClick=getHidden()>
<script type="" language="JavaScript">
myForm.objHidden.value=("Hidden object example")
function getHidden() {
y=myForm.objHidden.value
self.alert("The Hidden object's value is : "
+ y)
}
</script> </form>
This example creates a button that, when clicked, displays the Hidden object's value in an alert box.
Syntax: Object.constructor
This specifies a function to create an object's property and is inherited by all objects from their prototype.
Syntax: object.form
This property returns a reference to the parent Form of the Hidden object.
Syntax: object.name
This property sets or returns the value of the Hidden object's name attribute.
Syntax: Object.prototype.name = value
This allows the addition of properties and methods to any object.
Syntax: object.type
Every element on a form has an associated type property. In the case of a Hidden object, the value of this property is always "hidden".
Syntax: object.value
This property sets or returns the Hidden object's value attribute. This is the text that is held in the Hidden object until the form is submitted.
Syntax: Object.eval(string)
The eval method is deprecated as a method of Object, but is still used as a high level function. It evaluates a string of JavaScript in the context of an object.
Syntax: Object.toSource()
The toSource method returns a literal representing the source code of an object. This can then be used to create a new object.
Syntax: Object.toString()
The toString method returns a string representing a specified object.
Syntax: Object.unwatch(property)
This method removes a watchpoint set for an object and property name with the watch method.
Syntax: Object.valueOf()
This method returns a primitive value for a specified object.
Syntax: Object.watch(property, handlerfunction)
This method adds a watchpoint to a property of the object.