forms





js/script.js
  • function funMake() {
  •  for(var i=0; i<document.forms.length; i++) {
  •   document.getElementById('d1').innerHTML += document.forms[i].name + '<br />';
  •  }
  • }
  • function funMake() {
  •  for(var i=0; i<document.forms.length; i++) {
  •   document.getElementById('d1').innerHTML += document.forms[i].name + '<br />';
  •  }
  • }


index.html
  • <!DOCTYPE html>
  • <html>
  • <head>
  •  <meta charset="utf-8" />
  •  <title>New Page</title>
  •  <script src="js/script.js"></script>
  • </head>
  • <body>
  •  <form action="#" name="form0">
  •   <input type="text" name="txt0" />
  •   &nbsp;&nbsp;
  •   <input type="submit" name="perform" value="OK" />
  •  </form>
  •  <br />
  •  <form action="#" name="form1">
  •   <input type="text" name="txt0" />
  •   &nbsp;&nbsp;
  •   <input type="submit" name="perform" value="OK" />
  •  </form>
  •  <br />
  •  <div id="d1"></div>
  •  <script>
  •   funMake();
  •  </script>
  • </body>
  • </html>
  • <!DOCTYPE html>
  • <html>
  • <head>
  •  <meta charset="utf-8" />
  •  <title>New Page</title>
  •  <script src="js/script.js"></script>
  • </head>
  • <body>
  •  <form action="#" name="form0">
  •   <input type="text" name="txt0" />
  •   &nbsp;&nbsp;
  •   <input type="submit" name="perform" value="OK" />
  •  </form>
  •  <br />
  •  <form action="#" name="form1">
  •   <input type="text" name="txt0" />
  •   &nbsp;&nbsp;
  •   <input type="submit" name="perform" value="OK" />
  •  </form>
  •  <br />
  •  <div id="d1"></div>
  •  <script>
  •   funMake();
  •  </script>
  • </body>
  • </html>