HTML DOM forms 集合

定义和用法

forms 集合可返回对文档中所有 Form 对象的引用。

语法

  1. document.forms[]

实例

  1. <html>
  2. <body>
  3.  
  4. <form name="Form1"></form>
  5. <form name="Form2"></form>
  6. <form name="Form3"></form>
  7.  
  8. <script type="text/javascript">
  9. document.write("This document contains: ")
  10. document.write(document.forms.length + " forms.")
  11. </script>
  12.  
  13. </body>
  14. </html>