HTML DOM form Property
Complete Text Object Reference
Definition and Usage
The form property returns a reference to the form that contains the text
field.
This property returns a form object on success.
Syntax
Example
The following example gets the id of the form the text field belongs to:
<html>
<body>
<form id="form1">
<input type="text" id="text1" />
</form>
<p>The id of the form containing the text field is:
<script type="text/javascript">
x=document.getElementById('text1');
document.write(x.form.id);
</script></p>
</body>
</html>
|
Try-It-Yourself Demos
Get the id
of the form the text field belongs to
Complete Text Object Reference
|