![](http://headlineslist.com/images/banner.gif)
Correcting my Javascript math program?
|
04-08-2014, 04:17 AM
Post: #1
|
|||
|
|||
Correcting my Javascript math program?
Below is my Javascript math program. I'm not sure what I am doing wrong but it will not function properly. Please help!
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <title>JavaScript Functions</title> <script type="text/javascript"> var num1 = 0;//acts as a place holder for the user number var num2 = 0;//acts as a place holder for the user's second number var calculatedNum = 0;//place holder for the user's answer function calculation() { // type your calculation and output statements here calculatedNum = num1 * num2;//equation for the user's two numbers//holds user's first number and second number, then multiplies them together num1 = prompt("Please type the first number");//prompt asking for the user's first number num2 = prompt("Please type the second number");//prompt asking for the user's second number alert( num1 + " x " + num2 + " is " + calculatedNum + " ! " ); } // end calculation function </script> </head> <body> <h1></h1> </body> </html> Ads |
|||
« Next Oldest | Next Newest »
|
Messages In This Thread |
Correcting my Javascript math program? - Ajtolie - 04-08-2014 04:17 AM
|
User(s) browsing this thread: 1 Guest(s)