so coding, hope guys can me. i'm trying put result of calculation in textarea don't know how , should use.
i have been trying use span id , getelementbyid. think language used basic language.
<html> <head> <script type="text/javascript"> function bmicalc () { var fheight = document.form1.fheight.value; var fweight = document.form1.fweight.value; var result; result = fweight / ( fheight * fheight); return result; } </script> </head> <body> <p align="center"><b><font size="4">bmi calculator</font><b></p> <form name="form1" method="post" action=""> <table border="0" align="center"> <tr> <td>height:</td> <td><input name="fheight" type="text" size="15"> meters </tr> <tr> <td>weight:</td> <td><input name="fweight" type="text" size="15"> kilograms </tr> <tr> <td colspan="2" align="center"> <input type="submit" name="submit" value="get result" onclick="bmicalc()"> <input type="reset" name="reset" value="reset"> </td> </tr> <tr> <td colspan="2" align="center"> <textarea name="result" cols="30" rows="5" > bmi <result> </textarea> </tr> </body> </html>
function bmicalc () { var fheight = document.form1.fheight.value; var fweight = document.form1.fweight.value; var result; result = fweight / ( fheight * fheight); document.getelementbyid('result').innerhtml = result; }
Comments
Post a Comment