<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <title>213页作业1</title> </head> <body> <script type="text/javascript" > function Calc(){ //计算周长 document.formA.txtZhouChang.value = 2 * 3.14 * parseFloat(document.formA.txtBanJing.value); //计算面积 document.formA.txtMianJi.value = 3.14 * (parseFloat(document.formA.txtBanJing.value) * parseFloat(document.formA.txtBanJing.value)); } </script> <div> <center> <form name="formA" method="post" action="#" /> <table border="1"> <tr> <td colspan="2"><b>计算圆的周长和面积</b></td> </tr> <tr> <td>半径:</td> <td><input name="txtBanJing" type="text" /></td> </tr> <tr> <td>周长:</td> <td><input name="txtZhouChang" type="text" /></td> </tr> <tr> <td>面积:</td> <td><input name="txtMianJi" type="text" /></td> </tr> <tr> <td colspan="2"><input name="btnCalc" type="button" value="计算" onclick="Calc()" /></td> </tr> </table> </form> </center> </div> </body> </html>