查找表单的名称

  1. <html>
  2. <body>
  3.  
  4. <form id="myForm" method="get" name="myForm">
  5. Name: <input type="text" size="20" value="Bill Gates" />
  6. </form>
  7.  
  8. <script type="text/javascript">
  9. document.write("Form name: ");
  10. document.write(document.getElementById('myForm').name);
  11. </script>
  12.  
  13. </body>
  14. </html>