Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ssl/3.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
控制器未进入for循环:javascript_Javascript - Fatal编程技术网

控制器未进入for循环:javascript

控制器未进入for循环:javascript,javascript,Javascript,我用javascript写了一段代码,如下所示 alert(attributes.length); for(temp=0;temp<attributes.lenth;temp++){ attribute_list+="<option value='"+attributes[temp]+"'>"+attributes[temp]+

我用javascript写了一段代码,如下所示

                        alert(attributes.length);
                        for(temp=0;temp<attributes.lenth;temp++){
                            attribute_list+="<option value='"+attributes[temp]+"'>"+attributes[temp]+"</option>";
                            if(temp==0)
                                alert(attributes[temp]);
                        }
                        attribute_list+="</select>";
                        alert(attribute_list);
警报(attributes.length);

对于(temp=0;temp为什么不自己检查循环呢

alert(attributes.length);
for(temp=0;temp<attributes.lenth;temp++){

/* test the loop */
console.log(attributes.length);

}
警报(attributes.length);

对于(temp=0;tempattributes.lenth应该是attributes.length,打字错误?控制器呈现javascript,它不执行javascript,所以为什么要进入for循环?JS在客户端浏览器上执行。