Okay... let's play following the bouncing ball.

Code:
<div id='blueBall'>
  Blue Ball
</div>
<div id='blueBall'>
  Blue Ball
</div>
<div id='redBall'>
  Red Ball
</div>

<input id='ballCount'>

<script language='JavaScript'>
  function CountBall(ball) {
    document.ballCount.value = ball.length;
  }
</script>

<a href='javascript:void()' onclick='CountBall(blueBall)'>Count the Blue Ones</a>

<a href='javascript:void()' onclick='CountBall(redBall)'>Count the Red Ones</a>
Now, it counts 2 for the the blue balls but says undefined for the red ones.

Feces throwing monkeys.