So I'm working on this script for a class assignment that is due Monday afternoon, and I can't for the life of me get this switch to work...
Anybody know a javascript jedi who can look over my code and help me on the road to debugging this craptacular nonsense?
Edit for red, and cause I'm stupid:
//!--<script type="text/javascript">
function totalVotes(vote1-5) {
//calculate the sum of all values within an array.
var total = 0;
for (i = 1; i <= 5; i+=5);
return total;
}
function calcPercent(item, sum) {
//calculate a percentage, rounded to nearest integer
votes = item/sum*100(Math.round();
return votes
}
function createBar(partyType, percent) {
//write blank table cells for horizontal bar in election result
partyType = D, R, I, G, L;
percent = votes(Math.round();
switch (barText)
case "D": document.write(<td class='dem'></td>) ; break;
for (i = 1; i <= 5; i+=5);
case "R": document.write(<td class='rep'></td>) ; break;
for (i = 1; i <= 5; i+=5);
case "I": document.write(<td class='ind'></td>) ; break;
for (i = 1; i <= 5; i+=5);
case "G": document.write(<td class='green'></td>) ; break;
for (i = 1; i <= 5; i+=5);
case "L": document.write(<td class='lib'></td>) ; break;
for (i = 1; i <= 5; i+=5);
}
function showResults(race, name, party, votes) {
//shows the results of a particular race
var race = "race" document.write(
<h2>race</h2>
<table cellspacing='o'>
<tr>
<th>Candidate</th>
<th class='num'>Votes</th>
<th class='num'>%</th>
</tr>;
var name = "name":
<tr>
<td>name</td>
<td class='num'>votes</td>
</tr>;
var party = "party":
<tr>
<td>party</td>
<td class='num'>votes</td>
</tr>;
var votes = "votes":
<tr>
<td>votes</td>
<td class='num'>votes</td>;
var totalV = totalVotes(votes);
var percent ==calcPercent()
<td class='num'>(percent%)</td>;
createBar()
</tr>
</table>
</script>--//