Home  >  Article  >  Web Front-end  >  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
WBOYOriginal
2016-05-16 18:47:331055browse

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")
Statement:
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