To add all the values of all the text inputs on a page into an array, you do the following:
(要将页面上所有文本输入的所有值添加到数组中,请执行以下操作:)
var array = [];
var inputs = document.getElementsByClassName("input");
for(var i = 0; i < inputs.length; i++){
if(inputs[i].type == "text"){
array[array.length] = inputs[i].value;
}
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…