document.all 的问题

xiaoxiao2022-06-12  23

请看下面一段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,事实上是这样的吗?还是我的代码有问题。
转载请注明原文地址: https://www.6miu.com/read-4933386.html

最新回复(0)