html的DOM中document对象forms集合用法实例
本文实例讲述了html的DOM中document对象forms集合用法。分享给大家供大家参考。具体分析如下:
forms集合可返回对文档中所有Form对象的引用。
语法:
document.forms[]
例子:
<html> <body> <formname="Form1"></form> <formname="Form2"></form> <formname="Form3"></form> <scripttype="text/javascript"> document.write("Thisdocumentcontains:") document.write(document.forms.length+"forms.") </script> </body> </html>
希望本文所述对大家的javascript程序设计有所帮助。