<script language="javascript">
//你的页面上所有控件的数目
var IDcount=document.all.length
//得出所有控件的名字
for (i=0;i<IDcount;i++)
     alert(document.all(i).name);
</script>

解决方案 »

  1.   

    for (var i=0;i<document.formName.elements.length;i++)
                {
                var e = document.formName.elements[i];              if (e.name==控件名称)
                    {
                      value =e.value
                    
                  }
                }
      

  2.   

    <input type=text value=abc><br>
    <input type=text value=def><br>
    <input type=text value=ghi><br>
    <input type=button value=test onclick=test()>
    <script>
    function test(){
    var obj = document.all.tags("input") ;
    for (var i=0;i<obj.length;i++)
    if (obj[i].type=="text")
    alert(obj[i].value);
    }
    </script>