如果输入类型不存在,则javascript不工作
我有一个表,其中包含输入类型,如复选框、文本,如下所示如果输入类型不存在,则javascript不工作,javascript,html,Javascript,Html,我有一个表,其中包含输入类型,如复选框、文本,如下所示 var inputBoxes = table_check.getElementsByTagName('input'); //modified to get only input tags present within the table for(var i=0; i<5; i++) { Nos1=parseInt(inputBoxes[i+1].value);item_row_no=1; if(inputBoxes[i].val
var inputBoxes = table_check.getElementsByTagName('input'); //modified to get only input tags present within the table
for(var i=0; i<5; i++) {
Nos1=parseInt(inputBoxes[i+1].value);item_row_no=1;
if(inputBoxes[i].value){alert('No Input Box');} //fails at this if clause
else{Nos2=0;}
var-inputboxs=table_check.getElementsByTagName('input')//修改为仅获取表中存在的输入标记
对于(var i=0;i您的问题不清楚。如果您只是想根据输入类型的数量添加一个条件,您可以使用下面给出的方法
var inputBoxes = table_check.getElementsByTagName('input'); //modified to get only input tags present within the table
if(inputBoxes.length<5){
alert('No Input Box');
}
var-inputboxs=table_check.getElementsByTagName('input');//修改为仅获取表中存在的输入标记
if(inputboxs.length您的问题不清楚。如果您只是想根据输入类型的数量添加一个条件,您可以使用下面给出的方法
var inputBoxes = table_check.getElementsByTagName('input'); //modified to get only input tags present within the table
if(inputBoxes.length<5){
alert('No Input Box');
}
var-inputboxs=table_check.getElementsByTagName('input');//修改为仅获取表中存在的输入标记
if(inputboxs.length您的问题不清楚。如果您只是想根据输入类型的数量添加一个条件,您可以使用下面给出的方法
var inputBoxes = table_check.getElementsByTagName('input'); //modified to get only input tags present within the table
if(inputBoxes.length<5){
alert('No Input Box');
}
var-inputboxs=table_check.getElementsByTagName('input');//修改为仅获取表中存在的输入标记
if(inputboxs.length您的问题不清楚。如果您只是想根据输入类型的数量添加一个条件,您可以使用下面给出的方法
var inputBoxes = table_check.getElementsByTagName('input'); //modified to get only input tags present within the table
if(inputBoxes.length<5){
alert('No Input Box');
}
var-inputboxs=table_check.getElementsByTagName('input');//修改为仅获取表中存在的输入标记
如果(inputboxs.length您应该使用i您应该使用i您应该使用i您应该使用iinputboxs
是一个HTMLCollection
将其转换为数组
,如下所示:
var inputBoxes = document.getElementsByTagName('input');
inputBoxes = Array.prototype.slice.call(inputBoxes);
然后您可以检查inputBox的定义是否如此
if(inputBoxes[i] == undefined){
alert('No Input Box');
}
输入框
是一个HTMLCollection
将其转换为数组
,如下所示:
var inputBoxes = document.getElementsByTagName('input');
inputBoxes = Array.prototype.slice.call(inputBoxes);
然后您可以检查inputBox的定义是否如此
if(inputBoxes[i] == undefined){
alert('No Input Box');
}
输入框
是一个HTMLCollection
将其转换为数组
,如下所示:
var inputBoxes = document.getElementsByTagName('input');
inputBoxes = Array.prototype.slice.call(inputBoxes);
然后您可以检查inputBox的定义是否如此
if(inputBoxes[i] == undefined){
alert('No Input Box');
}
输入框
是一个HTMLCollection
将其转换为数组
,如下所示:
var inputBoxes = document.getElementsByTagName('input');
inputBoxes = Array.prototype.slice.call(inputBoxes);
然后您可以检查inputBox的定义是否如此
if(inputBoxes[i] == undefined){
alert('No Input Box');
}
为什么不检查输入框的长度?为什么不检查输入框的长度?为什么不检查输入框的长度?为什么不检查输入框的长度??