# Software

## Question

Locked

### help on java coding

By ·
this is a form i am trying to get to work in java script (what am i doing wrong cause it does nothing

<html>
<script language="javascript">

function triangle()
{
/* Calculate the area of a triangle. */
var length, height

length = parseFloat(document.calc.length.value)
if(isNaN(length))
{
alert("You need a value for length.")
document.calc.length.focus()
}
else
{
height = parseFloat(document.calc.height.value)
if(isNaN(height))
{
alert("You need a value for height.")
document.calc.height.focus()
}
else
{
document.calc.area.value = (height * length) / 2
}
}
}
function circle()
{
/* Calculate the area of a Circle. */

{
}
else
{
document.calc.area.value = (raduis * radius) * 3.14

}
}
}
function formReset()
{
document.getElementById("AreaCalculator").reset();
}

</script>

<title> Area Calculator</title>

<body>
<form name="AreaCalculator">

<table border="1">
<tr>
<td>
Simple Area Calculator:
</td>
</tr>
<tr>
<td>
Triangle Calculation:
</td>
<td>
Circle Calculation:
</td>
</tr>
<tr>
<td>
Length: <input type="text" name="length">
</td>
<td>
</td>
</tr>
<tr>
<td>
Height: <input type="text" name="height">
</td>
<td>
Area: <input type="text" name="triangle()">
</td>
</tr>
<tr>
<td>
Area: <input type="text" name="circle()">
</td>
<td>
<input type="button" value="Calculate Area" onclick="triangle()">
</td>
</tr>
<tr>
<td>
<input type="button" value="Calculate Area" onclick="circle()">
</td>
<td>
<input type="button" onclick="formReset()" value="Reset">
</td>
</tr>
</table>

</body>
</html>

This conversation is currently closed to new comments.

1 total post (Page 1 of 1)
Thread display: Collapse - | Expand +

Back to Software Forum
1 total post (Page 1 of 1)

## Related Discussions

• 0

#### Program to determine the values for the coefficients

sergiulzr ·

• 0

carlkasperholdt ·

• 2

#### How Technology Transformed the Vendor/Customer Relationship

hildgenmartin2 ·

• 24

bigskurl ·

• 2

Mounsif ·