Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa JavaScriptQuestions Javascript Question about converting Celcius to Fahrenheit
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Bartlomiej Talik
Javascript Question about converting Celcius to Fahrenheit
1 Answer(s)      a year and 3 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


Advertisement
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: <html> <
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
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 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
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
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
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
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
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
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 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
javascript
javascript  write a program to display implement about browsers using javascript
Converting PDF in to XML
Converting PDF in to XML  I have to convert PDF into XMl without any loss in text. Please suggest sth good
converting field to text sql
converting field to text sql  I wanted to convert the field to TEXT in SQL.. is it possible?   SQL - Converting the field to TEXT works SELECT CONVERT(TEXT,fld_name) FROM TABLE_NAME   SQL - Converting
Converting a NSString into NSDate
Converting a NSString into NSDate  hello. How can I create a NSDate object out of it and then get different components like day, month, date, year from it. I have date string: Tuesday, October 19, 2010
Converting string to Int - JDBC
Converting string to Int  String nrate=request.getParameter("t3"); i want convert this nrate to integer to make calculations on it... so what should i do??? where t3 is a text area name and i am fetching...  Hi
converting decimal to base 32
converting decimal to base 32  procedure for converting decimal to base 32   CREATE PROCEDURE RTCONVERSION ( @valueToConvert int, @convertedValue varchar(20) out ) AS declare @counter int; declare @num int; declare @x
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
 

 

 

DMCA.com