查找表单中的元素数量
- <html>
- <body>
- <form id="myForm" method="get">
- Name: <input type="text" size="20" value="Bill Gates" /><br />
- Text: <input type="text" size="20" value="Hello World" />
- </form>
- <script type="text/javascript">
- document.write("Number of elements in myForm: ");
- document.write(document.getElementById('myForm').length);
- </script>
- </body>
- </html>