Javascript Question about converting Celcius to Fahrenheit

Javascript Question about converting Celcius to Fahrenheit

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

View Answers

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>
<head>
<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;
    addTable(f);

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

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

        var rowCount = table.rows.length;
        if(rowCount < 1)
        {      
        var row = table.insertRow(rowCount);       
        alert("Number of Rows " +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>
</head>
<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.









Related Tutorials/Questions & Answers:
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:ADS_TO_REPLACE_1
Advertisements
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 a flex...
Question about a flex...  Is there good Future for Adobe flex
question about applet
question about applet  how to run java applet on wed browser   Hi Friend, Please visit the following link: Applet Tutorials Thanks
question about database
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
question about mixing two strings
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
Question about JSP - JSP-Servlet
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
ModuleNotFoundError: No module named 'celcius'
ModuleNotFoundError: No module named 'celcius'  Hi, My Python... 'celcius' How to remove the ModuleNotFoundError: No module named 'celcius... to install padas library. You can install celcius python with following command
ModuleNotFoundError: No module named 'celcius'
ModuleNotFoundError: No module named 'celcius'  Hi, My Python... 'celcius' How to remove the ModuleNotFoundError: No module named 'celcius... to install padas library. You can install celcius python with following command
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
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 "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
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
ModuleNotFoundError: No module named 'django-fahrenheit'
ModuleNotFoundError: No module named 'django-fahrenheit'  Hi, My... named 'django-fahrenheit' How to remove the ModuleNotFoundError: No module named 'django-fahrenheit' error? Thanks   Hi, In your
javascript
javascript  write a program to display implement about browsers using javascript
please help me to answers this question about C++.....huuhuhuhu
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
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
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
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
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
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  how to display the uploaded video file size in database using java or javascript
question
question  i need a simple javascript or jsp code to send message from one mail to another mail
question
question  i need a simple javascript or jsp code to send message from one mail to another mail
Question?
Question?  My question is how to: Add a menu bar to the program with a File menu. In the File menu, add a submenu (JMenuItem) called About. When the user clicks on the About menu item, display a JOptionPane message dialog
question
question  Dear sir i had some typing mistake at previous question so its my humble request to let me know the steps to start the tomcat6 under the tomcat directory
question
question  how to list images from a file and how to display that images as four different images in each row using jsp / javascript
question
question  how to loop table rows in javascript ,jsp ,i want to list four images in each rows from a file
javascript
javascript  how to create random question using javascript?   <html> <script> function displayQuestions...="button" value="Question" onclick="displayQuestions();"> <label id="lab">
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
javascript
javascript  javascript code to dynamically add table on button click.../javascript/javascriptexamples/javascript-add-row-dynamically.shtml http://www.roseindia.net/javascript/javascript-add-row-to-table.shtml http://www.roseindia.net
Javascript
Javascript  How validations are done using javascript ,with example? and interview questions on javASCRIPT
question
question  Good morning sir, i need a jsp and mysql code to track attendance immediately,and if you have any idea about how to take absentees please send me that too
question
question  Sir, How to stream video on one computer which is playing on another PC in LAN using java + socket / RMI . if you have any idea about that please help me and give the source code
question
question  do you have any idea about the following concept,give me Java code for A COMPARATIVE STUDY ON PERSONALIZATION IN INFORMATION RETRIEVAL WITH SHARING OF THE CONCEPT BASED USER PROFILES using Java
question
question  Good Afternoon Sir, could you please tell me about what is real process happened in "A DISTRIBUTED PROTOCOL TO SERVE DYNAMIC GROUPS FOR PEER-TO-PEER STREAMING" what is actually happened in this ,please help me
question
question  if you have any idea about automatic updation in mysql + jsp.i wrote a code for retrieving attendance.but i don't know how to display absentees.for example,assume that one employee is forgot to mark attendance
JavaScript
should use JavaScript? Thanks   Hi, JavaScript is scripting language that runs on browser. You have to embed JavaScript in HTML page. Please see JavaScript tutorial. Thanks
JavaScript
JavaScript  how to get full path of a file type in javascript
javascript
javascript  Hi deepak, how to write form validation on javascript
javaScript
javaScript  How to open a browser window that cannot be resized? (HTML + Javascript

Ads