HTML DOM form 属性
定义和用法
The form property returns a reference to the form that contains the text area.
This property returns a form object on success.
语法
textareaObject.form
实例
The following example returns the id of the form the text area belongs to:
<html>
<body>
<form id="form1">
<textarea id="txt1">
Hello world....This is a text area
</textarea>
</form>
<p>The id of the form containing the text area is:
<script type="text/javascript">
x=document.getElementById('txt1');
document.write(x.form.id);
</script>
</p>
</body>
</html>