...

View Full Version : Functions and show functions



worldtraveller
11-22-2010, 03:26 PM
Ok here is what I have so far, my ending part of my Call Function I think is ok.

for my main function. I think I misplaced the { and }

I will show you all the codes I have

for my main function

this is what I have


I think I did misplace something but I can not pin point where that one small things should be



unction showResults(race,name,party,votes)
{ // script element to display the results of a particular race
var totalV = totalVotes(votes);
document.write("<h2>" + race + "</h2>");
document.write("<table cellspacing='0'>");
document.write("<tr>");
document.write("<th>Candidate</th>");
document.write("<th class ='num'>Votes</th>");
document.write("<th class='num'>%</th>");
document.write("</tr>");
}


for (var i=0; i < name.length; i++)
{
document.write("<tr>");
document.write("<td>" name[i] + "(" + party[i] + ")</td>");
document.write("td class='num'>" + votes[i] + "</td>");

var percent=calcPercent(votes[i], totalV)

document.write("<td class='num'>(" + percent +"%)</td>");

createBar(party[i],percent)
document.write("</tr>");
}
document.write("</table>");
}
</script>

Just wondering if i misplaced any ; or { or } anywhere suggestions?


Here is my call function

<script type="text/javascript">

showResults(race[0],name1,party1,votes1);
showResults(race[1],name2,party2,votes2);
showResults(race[2],name3,party3,votes3);
showResults(race[3],name4,party4,votes4);
showResults(race[4],name5,party5,votes5);

</script>


I been going over this, I can not seem to figure out what { i might be missing?
Thanks

Philip M
11-22-2010, 04:41 PM
worldtraveller - you seem to have a hide like an elephant. One more time - please do not use this forum for remedial teaching and finding simple errors in your code. It ought to be obvious what your problem is - carelessness as usual.

Once again - in future use your error console or Firebug. It would throw up your typos at once.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum