当前位置:Gxlcms > JavaScript > html的DOM中document对象forms集合用法实例

html的DOM中document对象forms集合用法实例

时间:2021-07-01 10:21:17 帮助过:12人阅读

本文实例讲述了html的DOM中document对象forms集合用法。分享给大家供大家参考。具体分析如下:

forms 集合可返回对文档中所有 Form 对象的引用。

语法:
代码如下:document.forms[]
例子:
代码如下:<html> 
<body> 
 
<form name="Form1"></form> 
<form name="Form2"></form> 
<form name="Form3"></form> 
 
<script type="text/javascript"> 
document.write("This document contains: ") 
document.write(document.forms.length + " forms.") 
</script> 
 
</body> 
</html>

希望本文所述对大家的javascript程序设计有所帮助。

人气教程排行