Answer to Question #47676 in AJAX | JavaScript | HTML | PHP for john

Question #47676
I am trying to get a temperature conversion caculator to work for me and I seem to be having a confusing problem. The html code below is what I'm needing to follow by. <!DOCTYPE html> <html> <head> <title>Temperature Converter</title> </head> <body> <p>Enter a Temperature to Convert in the field below and select the starting scale.</p> <input type="text" name="txtTemp" id="txtTemp" placeholder="Enter a Temperature" /> <br /> <br /> <input type="radio" id="radFahrenheit" name="radTemp" checked/>Fahrenheit to Celcius <br/> <br/> <input type="radio" id="radCelcius" name="radTemp"/>Celcius to Fahrenheit <br/> <br/> <br/> <br/> <button onclick="ConvertTemp();">Convert</button> <br/> <br/> <div id="divResults"></div> <script type="text/javascript" src="Week7.js"></script> </body> </html> And with the javascript part I've gotten this so far also I'm not use to if and else statements yet. function ConvertTemp(){ var radFahrenheit = parsefloat(document.getElementById('radFahrenheit').value); var radCelcius = parsefloat(document.getElementById('radCelcius').value); var txtTemp = document.getElementById('txtTemp'); if(radF.checked){ radFahrenheit = (radCelcius * (9/5)) + 32; FahrenheitToCelcius(); }else if(radC.checked){ radCelcius = (radFahrenheit -32) * (5 / 9) CelciustoFahrenheit(); } }
Expert's answer

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!


No comments. Be first!

Leave a comment

Ask Your question

New on Blog