这是我的代码到目前为止.我想知道如何以小数点后两位返回答案. EX.而不是515.3我想要515.30或者不是500我希望它返回500.00.
<HTML> <HEAD> <TITLE>Simple Adder</TITLE> <SCRIPT LANGUAGE="JavaScript"> function CalculateSum(Atext,form) { var A = parseFloat(Atext); form.Answer.value = A * .03+.30+A; } function ClearForm(form) { form.input_A.value = ""; form.Answer.value = ""; } // end of JavaScript functions --> </SCRIPT> </HEAD> <BODY> <P><FONT SIZE="+2">Credit Card Payment Calculator</FONT></P> <FORM NAME="Calculator" METHOD="post"> <P>Enter Base Rent: <INPUT TYPE=TEXT NAME="input_A" SIZE=10></P> <P><INPUT TYPE="button" VALUE="Calculate Rent & Fees Payment" name="AddButton" onClick="CalculateSum(this.form.input_A.value,this.form)"></P> <P><INPUT TYPE="button" VALUE="Clear Fields" name="ClearButton" onClick="ClearForm(this.form)"></P> <P>Final Amount = <INPUT TYPE=TEXT NAME="Answer" SIZE=12></P> </FORM> </BODY> </HTML>