Monday, April 29, 2019

Fahrenheit To Celsius Converter in JQuery

A simple program that I wrote using JQuery to ask the user to give temperature in Fahrenheit and convert it into Celsius temperature equivalent.

I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me in the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.
My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.

My telephone number at home here in Bacolod City, Negros Occidental Philippines is  +63 (034) 4335675.

Here in Bacolod I also accepting computer repair, networking and Arduino Project development at a very affordable price.

My personal website is http://www.jakerpomperada.com



Sample Program Output

Program Listing

temperature.html

<html>
<head>
<title>Fahrenheit To Celsius Converter</title>
<script src="jquery-3.4.0.min.js"></script>
<style>
body {
 background-color:white;
 font-family: arial;
 font-size:15px;
 font-weight:bold;
 }

 .input_bold {
    font-weight: bold;
 font-size:15px;
 color:blue;
}

.input_bold2 {
    font-weight: bold;
 font-size:15px;
 color:black;
 }

.left {
    width: 15%;
    float: left;
    text-align: right;
    
}
.right {
    width: 50%;
    margin-left: 20px;
    float:left;
}

.header {
    width: 30%;
    float: left;
    text-align: right;
}

h4 {
text-align: center;
}
</style> 
<script>
    /* solve button */
$(document).ready(function() {
 
    $("#fahrenheit").on("keydown keyup", function() {
     //$("#solve").click(function() {
       var fah = $("#fahrenheit").val();
       celsius = (fah-32) * 5 / 9; 
       $("#results").val(celsius.toFixed(2) +" "+ String.fromCharCode(176) + "C");
     });

     
/* clear button */
    $("#clear").click(function(){
    $("#fahrenheit").val('');
    $("#results").val('');
    $("#fahrenheit").focus();
   });

});
 
   </script>
</head>
<body>
<form>
<br>
<div class="header">
<h3>Fahrenheit To Celsius Converter</h3>
</div>
<br><br><br><br><br>
<div class="left">
 Temperature in Fahrenheit 
</div>
<div class="right">
 <input type="text" id="fahrenheit"  name="fahrenheit"  class="input_bold2 "size="10" autofocus/><br>
</div>
<br><br>
<div class="left">
Celsius  Equivalent
</div> 
<div class="right">
 <input type="text" id="results" name="results"  class="input_bold" size="10" readonly />
</div> 
<br><br>
<div class="right">
<button type= "button" id ="clear" title="Click here to clear the textbox.">
Clear </button> 
<br>
</div>
</form>
</body>
</html>

No comments:

Post a Comment