Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/473.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如果输入类型不存在,则javascript不工作_Javascript_Html - Fatal编程技术网

如果输入类型不存在,则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您应该使用
i
inputboxs
是一个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');
}

为什么不检查输入框的长度?为什么不检查输入框的长度?为什么不检查输入框的长度?为什么不检查输入框的长度??