script多个同名控件的遍历访问

<form id="Form1" method="post">
            
<input type="text" id="sname" name="sname" >
            
<input type="text" id="sname" name="sname" >
        
<input type=button onclick = "doit()" value = "do">
        
<script>
        
function doit(){
           // alert(document.all(
"sname").length);
            
for(i =0;i<document.all("sname").length;i++)
            {
                alert(document.all(
"sname",i).value);
            }
}
        
</script>
posted on 2004-07-26 12:34  edobnet  阅读(946)  评论(0编辑  收藏  举报