Question:

JAVASCRIPT HELP!!! 10 POINTS FOR BEST ANSWER!!!?

by  |  earlier

0 LIKES UnLike

I made a javascript code and it isn't working. In the code you enter the three sides of a triangle and it is suposed to give the area, using Heron's formula. Why doens't it work

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>

<head><script language="JavaScript" type="text/javascript">

function triangle(form)

{

var a=eval(form.a.value);

var b=eval(form.b.value);

var c=eval(form.c.value);

ans=math.sqrt( a+b+c/2* (a+b+c/2-a) * (a+b+c/2-b) * (a+b+c/2-c) )

form.ans.value=ans;

}

</script>

<title>Triangle Area</title>

</head>

<body>

<form name=form>

Enter side1:<input type=text name=a size=5><br><br><br><br>

Enter the side2:<input type=text name=b size=5><br><br><br><br>

Enter the side3:<input type=text name=c size=5><br><br><br><br>

<input type = button value = "Calculate Area" onclick = "triangle(this.form)"><br><br><br>

Area:<input type = text name = ans size = 15>

</form>

</body>

</html>

 Tags:

   Report

2 ANSWERS


  1. change..
    math ==> Math

    10pts.. i was not login first time..


  2. change..
    math ==> Math

Question Stats

Latest activity: earlier.
This question has 2 answers.

BECOME A GUIDE

Share your knowledge and help people by answering questions.
Unanswered Questions