This article describes the usage of document object forms collection in html's DOM. Share it for your reference. The specific analysis is as follows:
The forms collection returns references to all Form objects in the document.
grammar:
Copy the code as follows: document.forms[]
example:
Copy the code as follows: <html>
<body>
<form name="Form1"></form>
<form name="Form2"></form>
<form name="Form3"></form>
<script type="text/javascript">
document.write("This document contains: ")
document.write(document.forms.length + " forms.")
</script>
</body>
</html>
I hope this article will be helpful to everyone's JavaScript programming.