0 LIKES LikeUnLike
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 (0) (0) | earlier
Latest activity: earlier. This question has 2 answers.