0
   

javascript temperature converter

 
 
Reply Wed 8 Oct, 2014 06:09 pm
heres the HTML file:
<!DOCTYPE html>
<html>
<head>
<title>Temperature Converter</title>
<script type="text/javascript" src="Week7.js"></script>
</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>
</body>
</html>

Im probably way off on my code but ehh I'm just now learning so with time will come experience and other good things:

function ConvertTemp(){
var radFahrenheit = document.getElementById('radFahrenheit');
var radCelcius = document.getElementById('radCelcius');
var txtTemp = document.getElementById('txtTemp');
var divResults = document.getElementById('divResults');

if(radF.checked){
{
radFahrenheit = (radCelcius * (9/5)) + 32;
divResults = radFahrenheit;
FahrenheitToCelcius();
}else if(radC.checked){
radCelcius = (radFahrenheit -32) * (5 / 9);
divResults = radCelcius;
CelciustoFahrenheit();
}
}

I really wish I could talk to my teacher to get guidance from him but it's fall break and this assignment is do before classes start back so I am hoping that you kind people can give me some guidance. Thank you also I know you don't have to help me at all but I really do appreciate those of you who will help me.
  • Topic Stats
  • Top Replies
  • Link to this Topic
Type: Question • Score: 0 • Views: 869 • Replies: 0
No top replies

 
 

Related Topics

 
  1. Forums
  2. » javascript temperature converter
Copyright © 2024 MadLab, LLC :: Terms of Service :: Privacy Policy :: Page generated in 0.04 seconds on 05/02/2024 at 02:16:30