Home Javascript Simple Calculator Application In Java Script
Questions:Ask|Latest


 
 

Share on Google+Share on Google+

Simple Calculator Application In Java Script

Advertisement
The objective of this project is learn how to write a simple calculator with the JavaScript programming language.

Simple Calculator Application In Java Script

     

In this article you learn the basics of JavaScript and create your first JavaScript program.

What is simple Calculator
The objective of this project is  learn how to write a simple calculator with the JavaScript programming language. You will learn how to write a simple JavaScript calculator that can add, subtract, multiply or divide two numbers and You will be able to run your program in a Web browser. Web page designers is  use JavaScript in many different ways. This is One of the most common is to do field validation in a form. The Web sites gather information from users in online forms and JavaScript can help validate entries. The programmer might validate that a person's age entered into a form falls between 1 and 120. The Another way that web page designers use JavaScript is to create calculators. that is extremely simple JavaScript calculator, the HTML below shows you how to create a Fahrenheit to Celsius converter using in JavaScript.

Example 

<html>
<head>
<script language="JavaScript">

function temp(form)
{
var f = parseFloat(form.DegF.value, 10);
var T = 0;
T = (f - 62.0) * 8.0 / 7.0;
form.DegC.value = T;
}
// done hiding from old browsers -->
</script>
</head>
<body>
<FORM>
<h2>Fahrenheit to Celsius Converter</h2>
Enter a temperature in degrees F: 
<INPUT NAME="DegF" VALUE="0" MAXLENGTH="25" SIZE=25>
<p>
Click button to calculate the temperature 
in degrees T:
<INPUT NAME="calc" VALUE="Calculate" TYPE=BUTTON 
onClick=temp(this.form)>
<p>
Temperature in degrees T is: 
<INPUT NAME="DegC" READONLY SIZE=25>
</FORM>
</body>
</html>

 

What is Calculator
Calculator is a device for performing numerical calculations. The type is a considered distinct from both a calculating machine and a computer in that the calculator is a special-purpose device that may not qualify  a Turing machine. Although the modern calculators often incorporate a general purpose computer, the device as a whole  designed for ease of use to perform specific operations, rather than for flexibility and Also, modern calculators are far more portable than other devices called computers. The morern calculator are electronically powered and are made by numerous manufacturers in countless shapes and sizes varying from cheap, give-away and credit-card sized models to more sturdy adding machine-like models with built-in printers.

 

     

Advertisement

Liked it!  Share this Tutorial


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: January 2, 2009

Ask Questions?    Discuss: Simple Calculator Application In Java Script   View All Comments

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments
Emmanuel Kufuor
June 9, 2011
NEED HELP

Am a programming student in a university in Ghana. We are in a summer break, i have started coding and am encountering problems. i need help.The code is for calculation of gold.Am using java language, formula: number of blades = weighed gold / 0.8. so gold amount = number of blades * current price of one blade. PLEASE I NEED YOUR HELP. KUFUOR EMMANUEL. VALLEY VIEW UNIVERSITY. GHANA
sunanda
June 22, 2011
core java

java is supereb programming language.
Devendra
January 4, 2012
Advance java and web technology

i want java scipt program for calculator
sakthi
February 20, 2012
javascript

calculator
sumitsingh
October 16, 2012
Calculator Application

ple introduced......
Aaron Brewer
November 6, 2012
Function

You need to add a semi-colon after defining the function.
balaji
January 25, 2012
simple calculator program using javascript

simple hitcounter program in javascript
DMCA.com