Hi guys and gals,

I am coding a quiz that will have 40 checkboxes that the user will be able to check.

(Right now I am trying to get this code to work with 4 and will change it to 40 once I figure out my problem.)

What I want to do is count up the amount of checked boxes and display it to the user.

I know I could do this with copying and pasting a line of code over and over again, but I thought it would be much smarter to use a loop and cut the JS down to only a few lines.

--A temporary file is set up at: http://design.suncitydesign.com/assets/AssetsJS.htm

This is my JS code:
<script type="text/javascript">

function doIt(){

var i = 0;
var count = 0;
var test = 'chk0';

var item = new Array('chk0', 'chk1', 'chk2', 'chk3');

  for (i=0;i<=3;i++){
  if (document.app.item[i].checked == true){count+=1;}

alert("The count is: " + count);


When run I get an error: 'document.app.item[...].checked' is null or not an object.

Does anyone know what I am doing wrong, I can't seem to figure it out, if it is even possible this way.