# Javascript Question about converting Celcius to Fahrenheit

Bartlomiej Talik
Javascript Question about converting Celcius to Fahrenheit
1 Answer(s)      4 years and 5 months ago
Posted in : JavaScript Questions

How to create a program to ask the user to enter a temperature in degrees celcius

it convert it to fahrenheit using the following formula: f = (c*9/5)+32;

It then displays the following table

|Celcius: | 30 |
|Fahrenheit | 56? |
I really have difficulties with it. Can you help me.

Do I have to put var celsius and Fahrenheit after opening javascript? Do I have to prompt both of them. I try and try and I don't know how to put this code right? I am student of Webmaster 2 and need to get this one till next thursday. Can you reply

May 27, 2013 at 7:54 PM

hi friend,

Try the following code, may this will be helpful for you

```<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Celcius To Farenheit</title>
<script type="text/javascript">
//function temp (form) {
function cToF(){
var c = document.getElementById("cl").value;
var f = c*(9/5)+32;
//var v = document.getElementById("fa").value = f;

//form.fahrenheit.value = form.celsius.value*(9/5)+32;
}

var table = document.getElementById("table1");

var rowCount = table.rows.length;
if(rowCount < 1)
{
var row = table.insertRow(rowCount);

var cell1 = row.insertCell(0);
var element1 = document.createTextNode("Fahrenheit");
cell1.appendChild(element1);

var cell2 = row.insertCell(1);
var element2 = document.createTextNode(tdValue);
cell2.appendChild(element2);
}
}
</script>
<body>
<form>
<div align="center">
<center><p><b>Input Celsius In Degree </b><input type="text" size="15" id="cl"></p></center>
<!--<center><p><b>Degrees In Fahrenheit <input type="text" size="15" id="fa"></b></p></center>-->
<center><p><input type="button" value=" Get Fahrenheit " onclick="cToF();"/></p></center>
</div>
<div id="ctof">
<table align="center" id="table1" border="1">
</table>
</div>
</form>
</body>
</html>
```

Thanks.

Javascript Question about converting Celcius to Fahrenheit
Javascript Question about converting Celcius to Fahrenheit  How...; It then displays the following table |Celcius: | 30 | |Fahrenheit | 56... to put var celsius and Fahrenheit after opening javascript? Do I have to prompt
Question on javascript
Question on javascript  There will be two combo box in HTML form.If... to do this using JavaScript??? or any other way in web application???   Hello Friend, In javascript, you can use the following code: <html> <
Question on javascript
Question on javascript  This is not exactly what i wanted....If i enter in 2nd combobox as name of child then it should show child id in 1st combobox automatically and vice versa
question about applet  how to run java applet on wed browser   Hi Friend, Please visit the following link: Applet Tutorials Thanks
question about database  sir i have made a drop down button using html..now i want to retrieve values from database so that they my appear in my drop down button..how can i do this....i have taken many fields such as type,ward id
JAVASCRIPT insert Question -
JAVASCRIPT insert Question  It is easy to transmit information from HOST program (in my case PHP program) to JAVASCRIPT insert. How may I reverse this, passing YES/NO information from a CONFIRM BOX back to the PHP program
question about mixing two strings  using java script we need to ask two strig and combine them like.. str1= helo str2= worl combined string= hweolrol
temperature converting
converted Celcius to Fahrenheit and vice versa. For this, we have create three functions celcius(), fahrenheit() and display table which display the conveted...))); } System.out.println("Fahrenheit (F) Celcius (C) "); for(int i=32;i<=212;i+=10
Question about JSP  Please tell me how to retrieve an image from SQL Server 2000 using JSP code.I know how to store the image as it stores in binary format. But i don't know hoe to retrieve
question about t vs h tag - Framework
question about t vs h tag  Hi, I use JSF with t,f,h tags in my webapp and i have a question. I use 2 differents pages .jsf The first page contain only tomahawk tags like : ....other tag tomahawks with call method X
Question about "Insert text file data into Database"
Question about "Insert text file data into Database"  Hey I was reading the tutorial "Insert text file data into Database", (awesome btw), and noticed that both a FileInputStream, a DataInputStream and a BufferedReader
Question about parsing XML document with DOM in JAVA.
Question about parsing XML document with DOM in JAVA.  Hi, I need to parse a XML file witch has info about classes. So i have for each class to have its methods and for each method to get its parameters. I'm trying to do
please help me to solve this question about array  write a program thatt stores vowels (a,e,i,o and u)in an array. Ask the user to enter any character. The program should ignore the case of that character (uppercase or lowercase
Urgent query about CreateTextFile using Javascript
Urgent query about CreateTextFile using Javascript  Dear All, I am creating a file using the code below which create a text file, but I don't want any body to access the same, either it should be password protected or it should
please help me to answers this question about C++.....huuhuhuhu  1) Write a full program for the bubble sort algorithm. User is required to enter specific input numbers and the program will be able to sort the given numbers
please help me to answers this question about C++.....huuhuhuhu  1) Write a full program for the bubble sort algorithm. User is required to enter specific input numbers and the program will be able to sort the given numbers
javascript
javascript  write a program to display implement about browsers using javascript
Converting the text files into bzip file.
Converting text  file into bzip file In this example, you will see, how to convert a text file into bzip file. In this example, we have printed 'I am a good programmer' along with converting a file into bzip file.  Opne the PHP
Converting ISO8601-compliant String to java.util.Date
Converting ISO8601-compliant String to java.util.Date  Converting ISO8601-compliant String to java.util.Date
Converting NSURL to NSString creating a problem
Converting NSURL to NSString creating a problem  Hi , In my iPad/iPhone universal application, we are trying to covert theNSURL to NSString which cause the application crash. Does any one have idea about converting NSURL
Converting NSURL to NSString creating a problem
Converting NSURL to NSString creating a problem  Hi , In my iPad/iPhone universal application, we are trying to covert theNSURL to NSString which cause the application crash. Does any one have idea about converting NSURL
Converting XML to string
Converting XML to string  Hi Friends, I had an requirement in which a java program receives an xml messages from external web application... some one suggest how can I go about it or could some one provide me with sample
converting string to double in java
converting string to double in java  Please post an example to converting string to double in java. Thanks!   Convert String to Double Tutorial
question
question   sir plz tell me what should i give in title box. just i want java program for the question typed in this area
question
question   sir plz tell me what should i give in title box. just i want java program for the question typed in this area
JavaScript
JavaScript  clone JavaScript
Question
Question   When there is an exception in my program how java runtime system handles
question
question  i used the following code to disable browser back page javascript:window.history.forward(1); but not worked .please give the correct code to disable back page using jsp or javascript
question
question  dear sir/madam my question is how to compare two text format in java..we are java beginners..so we need the complete source code for above mentioned question...we have to compare each and every word
question
question  i need a simple javascript or jsp code to send message from one mail to another mail