首先,不能用getElementByName( xx ),它是先判断id是否为xx,再判断name是否为xx.
不信楼主可以作试验,呵呵.
所以还是要写个函数
<script>
function getNum( theName )
{
var countA = 0 ;
var the = document.all ;
for( var i = 0 ; i < the.length ; i++ )
{
if( ( typeof the[ i ] ) == "object" && the[ i ].getAttribute("name") != null && the[ i ].name == theName )
{
countA++ ;
}
}
}
</script>