This Forum has been archived there is no more new posts or threads ... use this link to report any abusive content
==> Report abusive content in this page <==
Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
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

Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Correcting my Javascript math program? - Ajtolie - 04-08-2014 04:17 AM
[] - ? - 04-08-2014, 04:25 AM
[] - Dominic - 04-08-2014, 04:30 AM
[] - siteman - 04-08-2014, 04:38 AM

Forum Jump:


User(s) browsing this thread: 1 Guest(s)