chibicheebs
12-08-2009, 07:57 PM
Hey guys. This should be extremely easy for you to answer. This is actually for an intro to computers class I am taking and I am completely stumped. Basically I have to create a really simple Pythagorean Theorem calculator and this is what I have so far:
[CODE]
<html>
<head>
<title>A Pythagoras Conversion</title>
</head>
<script type="text/javascript">
var right_leg, left_leg, hypotenuse;
alert ("This calculates the hypotenuse of a right-angled triangle using the Pytahgorean Thereom. Press <OK> to continue!");
right_leg=prompt("Enter the length of the right leg.");
left_leg=prompt("Enter the length of the left leg.");
sq1 = right_leg*right_leg;
sq2 = left_leg*left_leg;
hypotenuse = math.sqrt(sq1 + sq2);
alert ("The Hypotenuse= ");
</script>
<body>
</body>
</html>
[CODE]
Everything works except for when it comes to it actually calculating. The calculation window never pops up. Please tell me what I am doing wrong in the calculation here....it is driving me nuts. :/
Thanks so much...
[CODE]
<html>
<head>
<title>A Pythagoras Conversion</title>
</head>
<script type="text/javascript">
var right_leg, left_leg, hypotenuse;
alert ("This calculates the hypotenuse of a right-angled triangle using the Pytahgorean Thereom. Press <OK> to continue!");
right_leg=prompt("Enter the length of the right leg.");
left_leg=prompt("Enter the length of the left leg.");
sq1 = right_leg*right_leg;
sq2 = left_leg*left_leg;
hypotenuse = math.sqrt(sq1 + sq2);
alert ("The Hypotenuse= ");
</script>
<body>
</body>
</html>
[CODE]
Everything works except for when it comes to it actually calculating. The calculation window never pops up. Please tell me what I am doing wrong in the calculation here....it is driving me nuts. :/
Thanks so much...