Simple JavaScript Calculator

Here i have a very simple script for a JavaScript calculator

It is a pretty basic script that uses a text field to create the equation with the buttons and then equates the equation to show you the answer.

There is also a Memory Store (MS), Memory Recall (MR), and a Memory Clear (MC). For those of you that may require it

<form name="Calc">
<input name="store" type="hidden" value="">
<div align="center">
<table border="0" cellpadding="0" cellspacing="5" id="Calculator">

<tr>
<td colspan="6"><div align="center">
<input id="Calcdisplay" name="Display" type="text" size="25" />
</div></td>
</tr>
<tr>
<td><div align="center">
<!-- By clicking on one of the buttons below the page takes the value from the display field and adds to it the value assigned to that button -->
<input id="Calcbtn" type="button" name="1" value="1" OnClick="Calc.Display.value += '1'">

</div></td>
<td><div align="center">
<input id="Calcbtn" type="button" name="2" value="2" OnClick="Calc.Display.value += '2'">
</div></td>
<td><div align="center">
<input id="Calcbtn" type="button" name="3" value="3" OnClick="Calc.Display.value += '3'">
</div></td>
<td>&nbsp;</td>
<td><div align="center">

<input id="Calcbtn" type="button" name="+" value="+" OnClick="Calc.Display.value += ' + '">
</div></td>
<td><div align="center">
<input id="Calcbtn" type="button" name="-" value="-" OnClick="Calc.Display.value += ' - '">
</div></td>
</tr>
<tr>
<td><div align="center">
<input id="Calcbtn" type="button" name="4" value="4" OnClick="Calc.Display.value += '4'">

</div></td>
<td><div align="center">
<input id="Calcbtn" type="button" name="5" value="5" OnClick="Calc.Display.value += '5'">
</div></td>
<td><div align="center">
<input id="Calcbtn" type="button" name="6" value="6" OnClick="Calc.Display.value += '6'">
</div></td>
<td>&nbsp;</td>
<td><div align="center">

<input id="Calcbtn" type="button" name="*" value="*" OnClick="Calc.Display.value += ' * '">
</div></td>
<td><div align="center">
<input id="Calcbtn" type="button" name="/" value="/" OnClick="Calc.Display.value += ' / '">
</div></td>
</tr>
<tr>
<td><div align="center">
<input id="Calcbtn" type="button" name="7" value="7" OnClick="Calc.Display.value += '7'">

</div></td>
<td><div align="center">
<input id="Calcbtn" type="button" name="8" value="8" OnClick="Calc.Display.value += '8'">
</div></td>
<td><div align="center">
<input id="Calcbtn" type="button" name="9" value="9" OnClick="Calc.Display.value += '9'">
</div></td>
<td>&nbsp;</td>
<td><div align="center">

<!-- To store values the page copies the value from the display field and inserts it into a hidden field named store. to retieve the stored value the page copies the value from the store and adds it to the value in the display -->
<input id="Calcbtn" type="button" name="MS" value="MS" OnClick="Calc.store.value = Calc.Display.value ">
</div></td>
<td><div align="center">
<input id="Calcbtn" type="button" name="MR" value="MR" OnClick="Calc.Display.value = Calc.Display.value += Calc.store.value">
</div></td>
</tr>
<tr>
<td><div align="center">

<!-- This button sets the display field to nothing -->
<input id="Calcbtn" type="button" name="C" value="C" OnClick="Calc.Display.value = ''">
</div></td>
<td><div align="center">
<input id="Calcbtn" type="button" name="0" value="0" OnClick="Calc.Display.value += '0'">
</div></td>
<td><div align="center">
<!-- This button calculates the sum, it does this by using the eval function and displays the result in the dsplay field -->
<input id="Calcbtn" type="button" name="=" value="=" OnClick="Calc.Display.value = eval(Calc.Display.value)">

</div></td>
<td>
<td>
<td><div align="center">
<!-- This button sets the hidden store field to nothing -->
<input id="Calcbtn" type="button" name="MC" value="MC" OnClick="Calc.store.value = ''">
</div></td>
</tr>
</table>

</div>
</form>

Hope you all enjoy this script

Related Blog Entries

Comments
Phil W. Lowder's Gravatar Thanks you Jonny, I've been playing around with the code and have learned
from doin so.
# Posted By Phil W. Lowder | 23/11/08 21:50
Gucci outlet's Gravatar Today i am in bad mood,but after readin your post,i feel better.
Whatever you think is fine with me.
en who were grossly overweight at the age of 18 had nearly 50 percent less chance of being married by their 30s and 40s,
said an international conference on obesity held in Amsterdam. have a nice summer day.
http://www.cheap-shoesonline.com/ cheap shoes online
# Posted By Gucci outlet | 06/07/10 14:16
sf's Gravatar Turning East, Turkey Asserts New Economic Power http://www.iqwsf.com
More Than Raging Sea, Oil Threatens Inn http://www.9kcq.com
Utah’s Gun Permit Popular With Nonresidents http://www.174cq.com
Hitting a Tiny Bull’s-Eye Miles Under the Gulf http://www.8kcq.com
To Stop Cheats, Colleges Learn Their Trickery http://www.iqwcq.com
# Posted By sf | 06/07/10 18:23
sf's Gravatar Turning East, Turkey Asserts New Economic Power http://www.iqwsf.com
More Than Raging Sea, Oil Threatens Inn http://www.9kcq.com
Utah’s Gun Permit Popular With Nonresidents http://www.174cq.com
Hitting a Tiny Bull’s-Eye Miles Under the Gulf http://www.8kcq.com
To Stop Cheats, Colleges Learn Their Trickery http://www.iqwcq.com
# Posted By sf | 06/07/10 18:23
sf's Gravatar I am jolly a great deal happy to discovery and your web log and discover the invaluable facts on the topic hashed out. You were arresting me occupied within 1 hour showing your blog and clauses. I genuinely apprize your blogging and dreaming up building a internet site by myself.

http://www.iqwsf.com
# Posted By sf | 06/07/10 18:23
cocoanti's Gravatar http://www.ghdhairs.org GHD sale & GHD online store & GHD on sale
http://www.ghdhairs.org/index.php?main_page=index&cPath=65
http://www.ghdhairs.org/index.php?main_page=index&cPath=66" target="_blank">http://www.ghdhairs.org/index.php?main_page=index&...
http://www.ghdhairs.org/index.php?main_page=index&cPath=67" target="_blank">http://www.ghdhairs.org/index.php?main_page=index&...
http://www.ghdhairs.org/index.php?main_page=index&cPath=68" target="_blank">http://www.ghdhairs.org/index.php?main_page=index&...
http://www.ghdhairs.org/index.php?main_page=index&cPath=69
# Posted By cocoanti | 09/07/10 09:38
coach handbags's Gravatar Excellent site, keep up the good work my colleagues would love this. I read a lot of blogs on a daily basis and for the most part, people lack substance but, I just wanted to make a quick comment to say I’m glad I found your blog. Thanks
<A href="http://www.coachsdesign.com/"; target=_blank><STRONG>coach handbags</STRONG></A>, <A href="http://www.coachsdesign.com/"; target=_blank><STRONG>coach purse</STRONG></A>, <A href="http://www.coachsdesign.com/"; target=_blank><STRONG>coach wallets</STRONG></A>, <A href="http://www.coachsdesign.com/"; target=_blank><STRONG>cheap coach bags</STRONG></A>
# Posted By coach handbags | 26/07/10 04:52
coach handbags's Gravatar This is my first time i visit here. I found so many entertaining stuff in your blog, especially its discussion. From the tons of comments on your articles, I guess I am not the only one having all the enjoyment here! Keep up the excellent work.
# Posted By coach handbags | 26/07/10 04:52
MBT Shoes Clearance's Gravatar been following your blog for 3 days now and i should say i am starting to like your post. and now how do i subscribe to your blog?
http://www.gstarmbt.com/
http://www.gstarmbt.com/mbt-kisumu-sandals-c-7.html
http://www.christianlouboutin2you.com/
http://www.gstarmbt.com/mbt-sapatu-sandals-c-27.html" target="_blank">http://www.gstarmbt.com/mbt-sapatu-sandals-c-27.ht...
http://www.christianlouboutin2you.com/christian-louboutin-fringe-c-249.html
http://www.christianlouboutin2you.com/christian-louboutin-pumps-c-244.html" target="_blank">http://www.christianlouboutin2you.com/christian-lo...
# Posted By MBT Shoes Clearance | 27/07/10 09:53
mbt shoes's Gravatar Let us crazy mbt shoes , <A href="http://www.mbtshoes2sale.com">mbt shoes sale</A> of our most popular,you can find the best prices MBT shoes for sell from us .
<A href="http://www.mbtshoes2sale.com">mbt shoes</A> have been specially designed by physiologists to offer a natural uneven,All mbt shoes wiht big discount were free shipping and not any tax from now on.
Enjoy the lastest <A href="http://www.mbtshoes2sale.com">discount mbt shoes</A>.
Welcome to here,<A href="http://www.kissmbtshoes.com">mbt shoes</A> for you.
The <A href="http://www.brandshoes2trade.com/">nike runing shoes </A> are well received around the world.
-----------------------------------------------------------------------------------
<A href="http://www.b2chandbag.com/loewe-handbags-c-26/&quo... handbags</A> is made with superior craftsmanship which is so well loved by all handbag fans.Get yourself sparking with <A href="http://www.b2chandbag.com/loewe-handbags-c-26/&quo... bags</A>.welcome to enjoy loewe handbags for free shipping.top quality loewe bags for discerning ladies.discount and <A href="http://www.b2chandbag.com/loewe-handbags-c-26/&quo... loewe handbags on line</A>.
<A href="http://www.b2chandbag.com/">prada handbags</A> is an italian fashion label specializing in luxury goods for men and women.Welcome to enjoy designer and discount prada bags sale.cheap and model <A href="http://www.b2chandbag.com/">prada bags</A> for free shipping.
Beautify your personal style with <A href="http://www.b2chandbag.com/balenciaga-handbags-c-1/... handbags </A>.b2chandbag designer handbag shop offer high quality Balenciaga bags.Shop popular brands and stores to find
<A href="http://www.b2chandbag.com/balenciaga-handbags-c-1/... bags</A>.top quality of balenciaga handbags for discerning ladies.welcome to enjoy balenciaga handbags sale.cheap and <A href="http://www.b2chandbag.com/balenciaga-handbags-c-1/... balenciaga handbags sale</A>.
# Posted By mbt shoes | 28/07/10 11:06
svgbfg's Gravatar <a href="http://www.christianlouboutinqueen.com/slingbacks"><strong>Discount" target="_blank">http://www.christianlouboutinqueen.com/slingbacks&... Christian Louboutin Slingbacks</strong></a> innate sultriness http://www.christianlouboutinqueen.com
<a href="http://www.yabags.com/louis-vuitton-c-12.html" title="Replica Louis Vuitton Bags" target="_blank">Replica Louis Vuitton Bags</a>
<a href="http://www.christianlouboutinqueen.com"><strong>Christian" target="_blank">http://www.christianlouboutinqueen.com">&l... Louboutin Shoes</strong></a>
<a href="http://www.chlsale.com"><strong>chri... louboutin sale</strong></a>
<a href="http://www.himbtshoes.com"><strong>MBT" target="_blank">http://www.himbtshoes.com"><strong>M... shoes</strong></a>
<a href="http://www.bagaol.com/" target="_blank">http://www.bagaol.com/balenciaga-c-105.html">replica balenciaga handbags</a>
<a href="http://www.bagaol.com"" target="_blank">http://www.bagaol.com"; title="Replica Hermes Handbags" target="_blank">Replica Hermes Handbags</a>
<a href="http://www.bagaol.com"" target="_blank">http://www.bagaol.com"; title="Replica Chanel Handbags" target="_blank">Replica Chanel Handbags</a>
<a href="http://www.bagaol.com/" target="_blank">http://www.bagaol.com/chanel-c-97.html" title="Chanel Replica Handbags" target="_blank">Chanel Replica Handbags</a>
<a href="http://www.christianlouboutinqueen.com"><strong>Christian" target="_blank">http://www.christianlouboutinqueen.com">&l... Louboutin Shoes</strong></a>
<a href="http://www.bagaol.com"" target="_blank">http://www.bagaol.com"; title="Wholesale Replica Handbags" target="_blank">Wholesale Replica Handbags</a>
http://www.yabags.com


----------------------------------------------------------------------------------------------------
[b][url=http://www.chlsale.com/]Christian Louboutin[/url][/b]
[b][url=http://www.chlsale.com/]louboutin shoes[/url][/b]
[url=http://www.himbtshoes.com][b]MBT Shoes[/b][/url]
[url=http://www.bagaol.com][b]Replica Handbags[/b][/url]
[url=http://www.bagaol.com/" target="_blank">http://www.bagaol.com/][b]Wholesale Replica Handbags[/b][/url]
[url=http://www.christianlouboutinqueen.com][b]Christian Louboutin[/b][/url]
[url=http://www.yabags.com][b]replica handbags[/b][/url]
[b][url=http://www.chlsale.com/]Christian Louboutin Shoes[/url][/b]
[b][url=http://www.chlsale.com/]cheap Christian Louboutin Shoes Sale[/url][/b]
[url=http://www.himbtshoes.com][b]MBT Shoes Sale[/b][/url]
[url=http://www.bagaol.com/" target="_blank">http://www.bagaol.com/][b]Knockoff Bags[/b][/url]
[url=http://www.bagaol.com][b]Replica Louis Vuitton Bags[/b][/url]
[url=http://www.christianlouboutinqueen.com][b]Christian Louboutin shoes[/b][/url]
[url=http://www.yabags.com][b]Fake Chanel Handbags[/b][/url] w
# Posted By svgbfg | 30/07/10 08:01
cosplay's Gravatar supply in stock and custom lace front wigs, full lace wigs, lace wigs, human hair wigs, remy lace front wigs, cheap wigs, cheap, buy, celebrity
<a href="http://www.lacewigssale.com">full lace wigs </a>
<a href="http://www.lacewigssale.com">lace wigs </a>
<a href="http://www.lacewigssale.com">lace wigs sale</a>
<a href="http://www.lacewigssale.com">lace front wigs</a>
<a href="http://www.lacewigssale.com">synthetic front lace wigs</a>
Full Lace Front Wig, Long & Short Hair Wigs: 80% OFF at Celebrity Wigs. We ensure 100% customer satisfaction with our Long & Short Indian Remy Hair Wigs.
<a href="http://www.weddingsale.ca/">wedding dresses</a>
<a href="http://www.weddingsale.ca/">evening dresses</a>
<a href="http://www.weddingsale.ca/">prom dresses</a>
# Posted By cosplay | 07/08/10 02:13
dual sim's Gravatar http://www.efox-shop.com

I read a lot of posts today and yours is the best one i have read ever.I appreciate your attitute
more info please visit the web for b2c iphone etc.
Ein seltenes Angebot: Im Handy-Shop des Mobilfunkbetreibers E-Plus steht
zurzeit das Dual-SIM-Handy Samsung B5722. Das Mobiltelefon für den parallelen
<a href="http://www.efox-shop.com"><b>Ciphone</b></a>" target="_blank">http://www.efox-shop.com"><b>Ciphone...;
# Posted By dual sim | 11/08/10 08:44
vibram five fingers's Gravatar I recently came across your blog and have been reading along.
I thought I would leave my first comment. I don’t know what to say except that I have enjoyed reading.Nice blog,I will keep visiting this blog very often.
http://www.christianlouboutindior.com Christian Louboutin Sale
http://www.christianlouboutindior.com Cheap Christian Louboutin
http://www.vibram-fivefingers.info cheap vibram five fingers
http://www.vibram-fivefingers.info barefoot shoes
http://www.discountedhardy.com/ed-hardy-men-appare... ed hardy men polos
http://www.discountedhardy.com/ed-hardy-men-appare... ed hardy men sweater
http://www.discountedhardy.com/ed-hardy-men-appare... ed hardy men knits
http://www.vibramfivefinger.info Five Fingers Shoes
http://www.vibramfivefinger.info Barefoot Shoes
http://www.five-fingers-vibram.info/vibram-five-fi... Vibram Five Fingers Men's Style
http://www.five-fingers-vibram.info/vibram-five-fi... Vibram Five Fingers KSO
# Posted By vibram five fingers | 13/08/10 09:43
Nike pas chere's Gravatar thanks for sharing
# Posted By Nike pas chere | 24/08/10 08:37
guild wars 2 gold's Gravatar The simple calculator is very useful and i use it very much.Thanks for your sharing.
# Posted By guild wars 2 gold | 24/08/10 09:38
Cosplay Costumes's Gravatar Sometimes when I read your blog,.....I think I'm falling in love! You are right on!
# Posted By Cosplay Costumes | 24/08/10 09:42
Nike Air Max's Gravatar Nice blog, looking good. :)
# Posted By Nike Air Max | 24/08/10 11:03
Airmax's Gravatar Well i think it is not the only way of seeing the topic
# Posted By Airmax | 24/08/10 11:10
Vertu Signature Diamonds's Gravatar Thanks for posting! I really enjoyed the report. I’ve already bookmark this article.
# Posted By Vertu Signature Diamonds | 24/08/10 11:18
wholesale mbt shoes's Gravatar welcome to: http://www.pointingtrade.com/
All kinds of world brand shoes,jeans,t-shirts,bikini,beach pants,handbags,wallets,sunglasses,belt,caps,watches etc..
<a href="http://www.pointingtrade.com/men-clothing-c-625.html">Wholesale" target="_blank">http://www.pointingtrade.com/men-clothing-c-625.ht... Clothing</a>
Our company specializes in manufacturing from located in CHINA and Netherlands,With more than 6 Years of experience,we are mainly dealing

with are:Nike shox?Christan Audigier t-shirt?Ed Hardy?COACH Bag?New Era cap ?Tiffany_Ring. More products.
<a href="http://www.pointingtrade.com/mbt-shoes-mbt-kisumu-sandals-c-353_623_1278.html">nfl" target="_blank">http://www.pointingtrade.com/mbt-shoes-mbt-kisumu-... jerseys</a>
Supply . COACH Bag?Nike shox.Ed Hardy t-shirt.
Safe Payment.Paypal<a href="http://www.pointingtrade.com/men-shoes-nike-shoes-c-353_416.html" >Nike Shoes</a><br>
Fast Shipment.5-7 days you can receive your order product.
No min order request.You can order only one product
<a href="http://www.pointingtrade.com/sinful-clothing-sinful-biniki-c-212_229_342.html">CA Bikini </a><br>
Free Shipping.The price on our website are including
everything.
http://www.pointingtrade.com/
<a href="http://www.pointingtrade.com/mbt-shoes-mbt-kisumu-sandals-c-353_623_1278.html">Wholesale" target="_blank">http://www.pointingtrade.com/mbt-shoes-mbt-kisumu-... Shoes</a>
<a href="http://www.pointingtrade.com/men-clothing-jerseys-c-625_818.html">nfl" target="_blank">http://www.pointingtrade.com/men-clothing-jerseys-... jerseys</a>
<a href="http://www.pointingtrade.com/men-shoes-mbt-shoes-c-353_623.html">MBT" target="_blank">http://www.pointingtrade.com/men-shoes-mbt-shoes-c... Shoes</a><br>
<a href="http://www.pointingtrade.com/men-shoes-jordan-shoes-c-353_356.html">Jordan" target="_blank">http://www.pointingtrade.com/men-shoes-jordan-shoe... Shoes</a><br>
<a href="http://www.pointingtrade.com/men-shoes-nike-shoes-c-353_416.html" >Nike Shoes</a><br>
<a href="http://www.pointingtrade.com/women-shoes-christian-louboutin-c-1_7.html">Christian" target="_blank">http://www.pointingtrade.com/women-shoes-christian... Louboutin Shoes</a><br>Thank you for your

support.
a leading worldwide wholesale company (or ucan say organization). We supply more than 100 thousand high-quality merchandise and famous brand

name products all at wholesale prices.
# Posted By wholesale mbt shoes | 25/08/10 10:12
timberland shoe company's Gravatar We are traveling by train. Out timberland hiking boots windows, we drink in the passing scene of cars on nearby highways, of children timberland shoe company waving at a crossing, of cattle grazing on a distant timberland boots hillside, of smoke pouring from a power plant, of row upon row of corn and wheat, of flatlands and timberland wheat shoes valleys, of mountains and rolling classic 3 eye timberland boat hillsides, of city skylines and village halls.But uppermost in our black timberland boots minds is the final destination.
# Posted By timberland shoe company | 28/08/10 07:44
????'s Gravatar hi there, nice blog this is that you have - i am really interested in reading more of your posts,keep up the good work!
http://www.iqwcs.com/
http://www.iqwkk.com/
http://www.5kcq.com/
http://www.cc-sf.com/
http://www.aa-sf.com/
# Posted By ???? | 31/08/10 10:32
????'s Gravatar hi there, nice blog this is that you have - i am really interested in reading more of your posts,keep up the good work!
http://www.iqwcs.com/
http://www.iqwkk.com/
http://www.5kcq.com/
http://www.cc-sf.com/
http://www.aa-sf.com/
# Posted By ???? | 31/08/10 10:38
# Posted By air max 2010 | 02/09/10 07:18

Archives By Subject

Advertising (4) [RSS]
Blog Design (1) [RSS]
CFProject Scripts (2) [RSS]
Coldfusion Charts (3) [RSS]
Coldfusion Functions (5) [RSS]
Coldfusion Overview (1) [RSS]
Coldfusion Tutorials (16) [RSS]
For Sale (2) [RSS]
Image Manipulation (1) [RSS]
Java (1) [RSS]
JavaScript (4) [RSS]
PHP (1) [RSS]
Railo (4) [RSS]
SQL (1) [RSS]
Useful Tools (3) [RSS]

Recent Comments

Coldfusion and Java
nike air max shoes said: Free shipping buy coach handbags in coach outlet online,save up 76%,[url=http://www.coachhandbags-...... [More]

Coldfusion and Java
coach handbags said: These four pairs are all from Sergio Rossi. And their color is all can match well with your wedding ... [More]

Select Last Number In Access
coach handbags said: These four pairs are all from Sergio Rossi. And their color is all can match well with your wedding ... [More]

Select Last Number In Access
nike air max shoes said: Free shipping buy coach handbags in coach outlet online,save up 76%,[url=http://www.coachhandbags-...... [More]

Unlimited Website Hosting
nike air max shoes said: Free shipping buy coach handbags in coach outlet online,save up 76%,[url=http://www.coachhandbags-...... [More]

Recent Entries

No recent entries.
ColdFusion Blog | ColdFusion Hosting | ColdFusion Q & A