Script Categories













Calculators >>> Pythagorean.

One of geometry's most useful formulas, the Pythagorean Theorem, can be applied to the numbers you enter in JavaScript! Just enter 'A' and 'B' and the script solves for 'C'.

The Pythagorean Theorem

( a2 + b2 = c2 )

2 + 2 =

Add the below code to the <body> section of your page:

<script language="javascript" type="text/javascript">
/* Visit http://www.yaldex.com/ for full source code
and get more free JavaScript, CSS and DHTML scripts! */
<!-- Begin
function solvepy(form) {
a = parseInt(form.a.value);
b = parseInt(form.b.value);
form.c.value = Math.sqrt(a*a + b*b);
}
//  End -->
</script>
<form>
The Pythagorean Theorem
<br><br>
<
tt>( a<sup>2</sup> + b<sup>2</sup> = c<sup>2</sup> )</tt>
<
br><br>
<input type=text name=a size=3><sup>2</sup> +
<input type=text name=b size=3><sup>2</sup> =
<input type=text name=c size=8>
<br><br>
<input type=button value="Solve" onClick="solvepy(this.form)">
</form>

JavaScript Editor Get Advanced
JavaScript and Ajax Editor,
Validator and Debugger!

1st JavaScript Editor.



Code was highlighted by 1st JavaScript Editor (The Best JavaScript Editor!).

R7


©