Home > Web Front-end > JS Tutorial > JavaScript traverses and verifies the values ​​of all text boxes_form effects

JavaScript traverses and verifies the values ​​of all text boxes_form effects

WBOY
Release: 2016-05-16 18:47:33
Original
1070 people have browsed it

Idea:
Everyone knows that the type of text box input is text, so we only need to traverse all inputs, determine whether the type is text, and then determine the value of the specified field to meet the requirements
The specific code is as follows:

Copy code The code is as follows:

var aa = document.getElementsByTagName("input");
var bb = 0;
for(var i=0;i{
var avalue = aa[i].value;
var atype = aa[i] .type;
if(atype == "text")
bb ;
}
alert("Total" bb "item text")
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template