JavaScript - I Am Desperate!
Similar TutorialsOoops!
(edit) i've fixed it. thanks
Hey guys, i'm taking on my first minor project in javascript and i've run into an error. For whatever reason, buttons i've defined are calling on functions that supposedly don't exist, yet they are clearly in the code and can be applied anywhere. I also checked the syntax errors in google chrome and they state: Uncaught SyntaxError: Unexpected token else Uncaught reference error: go() is not defined Uncaught reference error: highscore() is not defined. So without further delay, here is the full code. Can anyone help me out? Code: <html> <head> <script type="text/JavaScript"> <!-- var sam = 9; var sally = 8; var donald = 4; function percentage (score) { return score / 10 * 100; }; function go() { document.write("Sam's score on the test is " + percentage(sam) + "%, <br \> Sally's score on the test is " + percentage(sally) + "%, <br \> Donald's score on the test is " + percentage(donald) + "%"); }; function highscore() { if (Math.max(90, 80, 40) === 90){ document.write("Sam's score was the highest.")}; else if (Math.max(90, 80, 40) === 80){ document.write("Sally's score was the highest.")}; else{ document.write("Donald's score was the highest.")} }; //--> </script> </head> <body> <input type="button" onclick="go()" value="Student Grades"> <br \> <input type="button" onclick="highscore()" value="Highest Score"> </body> </html> i have this slideshow, Swiss Army Image slideshow i got from DDrive. it has forward and back buttons that are disabled unless the Play/Stop button is in Stop mode. i cannot for the life of me figure out how to enable the buttons always. please can someone help? i have a maniac client who's now threatening not to pay because of this one thing!!! installation: http://cssphpmysql.com/dev/westermancm/library2.html js: http://cssphpmysql.com/dev/westermancm/js/swissarmy.js thanks so much! GN |