View Single Post
Old 11-13-2012, 05:26 PM   PM User | #5
coothead
Senior Coder

 
coothead's Avatar
 
Join Date: Jan 2004
Location: chertsey, a small town 25 miles south west of london, england.
Posts: 1,551
Thanks: 0
Thanked 195 Times in 191 Posts
coothead will become famous soon enough
Hi there andynov123,

I have commented out the errors...
Code:

<script type ="text/javascript">
function totalVotes(){
var total = 0;
//var counter=0;
//var votes= = [94766, 168751, 116492, 103516, 86855];
  var votes= [94766, 168751, 116492, 103516, 86855];
/*
votes0[0] = 94766;
votes1[1] = 168751;
votes2[2] = 116492;
votes3[3] = 103516;
votes4[4] = 86855;
*/
//for(i=0; i<=votes[counter];i++){
  for(i=0; i<votes.length;i++){
total = votes[i] + total;
window.alert("The total is: " + total);
}
}
</script>

<script type="text/javascript">
totalVotes();
</script>
coothead
coothead is offline   Reply With Quote