Script Categories













Calculators >>> Polygon.

Figure out the number of sides, measure of each exterior angle, and the measure of the interior angle of any polygon. Simply enter one of the three pieces of information!

The sum of the measures of the angles of a convex polygon with n sides is (n - 2)180.

Sides on the polygon:
Measure of each exterior angle:
Measure of each interior angle:

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 side(form) {
var n = document.form1.n.value;
document.form1.n.value = n;
document.form1.intx.value = ((n - 2) * 180) / n;
document.form1.ext.value = 180 - document.form1.intx.value;
}
function extn(form) {
var e = document.form1.ext.value;
document.form1.n.value = 360 / e;
document.form1.intx.value = 180 - e;
}
function intn(form) {
var i = document.form1.intx.value;
document.form1.ext.value = 180 - i;
document.form1.n.value = 360 / (180 - i);
}
//  End -->
</script>
The sum of the measures of the angles of a convex polygon with <i>n</i> sides is <b>(<i>n</i> - 2)180.</b><br>
<
br>
<form name="form1">
<table width="500" border="1">
<tr>
<td
width="45%">
Sides on the polygon:</td>
<td>
<input name="n"></td>
<td>
<input type="button" value=" Find " onClick="side(this.form)"></td></tr>
<tr>
<td
width="35%">
Measure of each exterior angle:</td>
<td>
<input name="ext"></td>
<td>
<input type="button" value=" Find " onClick="extn(this.form)"></td></tr>
<tr>
<td
width="20%">
Measure of each interior angle:</td>
<td>
<input name="intx"></td>
<td>
<input type="button" value=" Find " onClick="intn(this.form)"></td></tr>
</table>
</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


©