I have a simple temperature conversion program. When you click the buttons the answer flashes. Changing type="submit" to type="button" fixes that, but then the request doesn't work and the answer isn't right. What can I do here? Thanks in advance for any help.

public Double calc(int type, String x) {

double Tc,Tf;

if((type == 1) && (x != null) && (!x.equals("")))
Double C = Double.parseDouble(x);

return Tf;

else if((type == 2) && (x != null) && (!x.equals("")))

Double F = Double.parseDouble(x);

return Tc;


else return 0.0;



Celsius :
<INPUT TYPE="TEXT" NAME="Celsius" id="Celsius">
<INPUT TYPE="SUBMIT" NAME = "but_1" id="but_1" VALUE="Convert to Fahrenheit" onClick='document.getElementById("Fahrenheit").value = <%=calc(1, request.getParameter("Celsius"))%>' ></INPUT>

<br> Fahreinheit :
<INPUT TYPE="TEXT" NAME ="Fahrenheit" id="Fahrenheit" >
<INPUT TYPE="SuBMIT" NAME = "but_2" id="but_2" VALUE="Convert to Celsius" onClick='document.getElementById("Celsius").value = <%=calc(2, request.getParameter("Fahrenheit"))%>' ></INPUT>