请看下面一段js代码
var count="0";if(document.getElementById("typevalue")!=null) { var obj1=document.all("typevalue"); count=obj1.length for(var i=0;i<obj1.length;i++){ if(i==0) { types=obj1[i].value; }else{ types=types+","+obj1[i].value; } } }
问题出在count=obj1.length上,如果name为typevalue的html标签只有一个时,obj1.length为undefined,事实上是这样的吗?还是我的代码有问题。