<!DOCTYPE html><html><body><h1>sharejs.com</h1><form name="Form1"></form><form name="Form2"></form><form></form><p>Number of forms:<script>document.write(document.forms.length);</script></p></body></html>运行结果如下:
Number of forms: 3希望本文所述对大家的javascript程序设计有所帮助。