crazyeyez51
08-18-2007, 09:31 PM
I need help with a program Im trying to write. This program is a area and perimeter program, you enter in the length of a side on a square and you click the area button and gives you the area and the perimeter button gives you the perimeter. I have this so far, I cant even get the area button to work and dont know what to do with the perimeter button
<html>
<head>
<title>Area & Perimeter</title>
<script language="JavaScript">
function area//parameter
{
alert("The 'area' of your square is" + area1 );
} //end outputFunction
var length = parseInt(prompt("Type the Length of your square:","10"));
var area1 = length * length;
area; //call to function from prompt
</script>
</head>
<body>
<form>
<input type = "button"
onClick = "area;"
value = "Area"> <!-- call to function from button//-->
</form>
</body>
</html>
<html>
<head>
<title>Area & Perimeter</title>
<script language="JavaScript">
function area//parameter
{
alert("The 'area' of your square is" + area1 );
} //end outputFunction
var length = parseInt(prompt("Type the Length of your square:","10"));
var area1 = length * length;
area; //call to function from prompt
</script>
</head>
<body>
<form>
<input type = "button"
onClick = "area;"
value = "Area"> <!-- call to function from button//-->
</form>
</body>
</html>