# 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
{

}
}
}
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.

Thread display: Collapse - | Expand +

## Related Discussions

• 8

quangtuyennguyen ·

• 3

#### How do I convert MBOX to PDF?

singhrohit120897 ·

• 12

ficodesoftwaredeve ·

• 5

trederedet ·

• 7

#### PDF repair? Nothing working

denekernohan ·