codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:
Search Forums:
  somebody help me please. i becoming mad.  say13 at 21:59 on Wednesday, January 28, 2009
 

here is the javascript i've been written..to find a certains votes for candidates..
can somebody help me to 'how to find the total votes of all the candidates please..
many thanks..

i just need the javascript code to find the total of votes..thanks.

if someone can copy and paste the code into a notepad/brower and help me!






////////////////////////////////////////////////////////////////////////////////////

<HTML>
<HEAD>
<TITLE>
Ques.
</TITLE>
<SCRIPT >

/* Program to perform the calculations about a vote cast */

var candidateArray = new Array(5);

var totalCandidatesArray = ['Candidate 1...votes' + ' : ','Candidate 2...votes' + ' : ','Candidate 3...votes' + ' :

','Candidate 4...votes' + ' : ','Candidate 5...votes' + ' : '];

var totalVotes;



for (var votes = 0; votes < candidateArray.length; votes = votes + 1)
{
candidateArray[votes] = window.prompt('Please enter the votes cast for candidate ' + (votes + 1),'');
}


document.write('<BR>' + '<BR>');


for (var votes = 0; votes < candidateArray.length; votes = votes + 1)
{
document.write(totalCandidatesArray[votes] + candidateArray[votes] + '<BR>');
}









</SCRIPT>
</HEAD>
<BODY>
</BODY>
</HTML>


///////////////////////////////////////////////////////////////////////////////////////////////////













































CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums
//








Recent Forum Threads
•  somebody help me please. i becoming mad.
•  JTable in JSP page
•  Re: open excel file in html page
•  WYSIWYG Editor
•  Re: Text wrapping on C# webforms buttons
•  Re: Pcl file
•  DIV IFRAME simulation
•  Onclick does not work using input type = "button"
•  Animation works on IE but not on Firefox


Recent Articles
ASP GetTempName
Decode and Encode UTF-8
ASP GetFile
ASP FolderExists
ASP FileExists
ASP OpenTextFile
ASP FilesystemObject
ASP CreateFolder
ASP CreateTextFile
Javascript Get Selected Text


© Copyright codetoad.com 2001-2009