Pages

Subscribe:

JavaScript Calculator

This is a simple calculator implementing with JavaScript and Html .This calculator will do division , multiplication  ,addition and subtraction operations  .

Program :


<html>
<head></head>
<script language="JavaScript"> 
function calc(ch){ // javasript function with parameter 
if(ch=="=")
form1.t.value= eval(form1.t.value);
else
if(ch=="C")
form1.t.value= "";
else
form1.t.value+=ch;
}
</script>
<body onLoad="getTimes()">
<form name="form1" method="post" action="">
<input name="t" type="text" id="t">
<br>
<input type="button" name="Button" value="7" onClick="calc('7')"> 
<input type="button" name="Submit2" value="8" onClick="calc('8')">
<input type="button" name="Submit3" value="9" onClick="calc('9')">

<input type="button" name="Submit4" value="+" onClick="calc('+')">
<br>
<input type="button" name="Submit5" value="4" onClick="calc('4')">
<input type="button" name="Submit6" value="5" onClick="calc('5')">
<input type="button" name="Submit7" value="6" onClick="calc('6')">
<input type="button" name="Submit8" value="-" onClick="calc('-')">
<br>
<input type="button" name="Submit9" value="1" onClick="calc('1')">
<input type="button" name="Submit10" value="2" onClick="calc('2')">
<input type="button" name="Submit11" value="3" onClick="calc('3')">
<input type="button" name="Submit12" value="*" onClick="calc('*')">
<br>
<input type="button" name="Submit13" value="0" onClick="calc('0')">
<input type="button" name="Submit14" value="C" onClick="calc('C')">
<input type="button" name="Submit15" value="=" onClick="calc('=')">
<input type="button" name="Submit16" value="/" onClick="calc('/')">

<br>
</form>
</body>
</html>


Output :

If you have any Further Information and Quires about this Article don't hesitate to comment in comment box below.
                                                           AND

 If you like this article , like our Facebook like page and click  +1 to support 123techguide
comments powered by Disqus
 

Listed In

Bloggers - Meet Millions of Bloggers http://Link-exchange.comxa.com
Blog Search: The Source for Blogs Internet Blogs

Disclaimer

The contents in this blog are taken from various sources available over the internet, therefore we do not gurantee of it's accuracy, if you find any of the content in the blog is infringing it's copyright, please do email us on '123techguide@gmail.com' and we will make sure to remove the same from the blog at the earliest.