Create a file called tempconv.htmlHave a text box that you enter your temperature intoInstead of a textbox to write the answer, use a div and getElementById and innerHTMLHave a button that converts from C to FHave another button that converts from F to CUse 2 separate functionsmake sure ALL your javascript code is up in the headSet up an event for the button (Links to an external site.) to do the calculationsThe two functions needed are below:
function convertToC(F){var result = (temp -32) * (5/9);return result;}
var c = convertToC(78);
function convertToF(C){var result = (temp * (9/5)) + 32;return result;}
var f = convertToF(25);
Reviews
There are no reviews yet.