I'm trying to get each of the if statements below in a text text box with the result depending on the answer of the equation. However i can't figure out a way to allow the user to click a button to to show the result in a text box. If anyone could help it would be much appreciated.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<script type="text/javascript">
function calculate() {
A = document.form1.text2.value
B =(parseInt(A ) * 52)
D= (parseInt(B ) * 0.015 )
if ( B <= 6000){
tax = 0;}
else
if (B <= 37001){
tax = (B - 6000) * .15;
} else
if (B<= 80001){
tax = (B - 37000) * .30 + (37000 - 6000) * .15;
} else
if (B <= 180001){
tax = (B- 80000) * .37 + (80000- 37000) * .30 + (37000 - 6000) * .15;
} else
tax = (B - 180000)* .45 + (180000 - 80000) * .37 + (80000- 37000) * .30 + (37000 - 6000) * .15;}
</script>
</HEAD>
<BODY>
<form name="form1">
Weekly Salary: <INPUT TYPE="TEXT" NAME="text2">
<INPUT TYPE="BUTTON" VALUE="SUBMIT" Onclick="calculate();">
</BODY>
</HTML>


