|
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>
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
// |