欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

javascript 遍歷驗(yàn)證所有文本框的值

 更新時(shí)間:2009年08月27日 17:46:29   作者:  
遍歷所有文本框的值并判斷是否為數(shù)字
思路:
大家知道文本框input的type為text,所有我們只要遍歷所有input,判斷其type是否為text,然后再判斷指定字段的值即可達(dá)到要求
具體代碼如下:
復(fù)制代碼 代碼如下:

var aa = document.getElementsByTagName("input");
var bb = 0;
for(var i=0;i<aa.length;i++)
{
var avalue = aa[i].value;
var atype = aa[i].type;
if(atype == "text")
bb++;
}
alert("共有"+bb+"項(xiàng)text")

相關(guān)文章

最新評(píng)論