js 一个简单的遍历表单元素的实例

WBOY
Release: 2016-06-01 09:54:58
Original
1567 people have browsed it
 
Copy after login

本实例中的表单又四个元素,分别为3个text文本域和一个button。

document.forms[0]用于获取文档中的第一个表单(该页面只有一个表单),然后使用length获取表单的长度,再使用for遍历表单元素并获取每个元素的值。

你可以把代码复制到这个页面运行一下。

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!