Skip to main content

cool and best html calculator code

Guyz in this tutorial i'm going to provide you the code for calculator .
              Want to check it ,check it out it.


Grabitin

HTML
<CENTER>
<FORM name="Keypad" action="">
<TABLE>
<B>
<TABLE border=2 width=50 height=60 cellpadding=1 cellspacing=5>
<TR>
<TD colspan=3 align=middle>
<input name="ReadOut" type="Text" size=24 value="0" width=100%>
</TD>
<TD
</TD>
<TD>
<input name="btnClear" type="Button" value="  C  " onclick="Clear()">
</TD>
<TD><input name="btnClearEntry" type="Button" value="  CE " onclick="ClearEntry()">
</TD>
</TR>
<TR>
<TD>
<input name="btnSeven" type="Button" value="  7  " onclick="NumPressed(7)">
</TD>
<TD>
<input name="btnEight" type="Button" value="  8  " onclick="NumPressed(8)">
</TD>
<TD>
<input name="btnNine" type="Button" value="  9  " onclick="NumPressed(9)">
</TD>
<TD>
</TD>
<TD>
<input name="btnNeg" type="Button" value=" +/- " onclick="Neg()">
</TD>
<TD>
<input name="btnPercent" type="Button" value="  % " onclick="Percent()">
</TD>
</TR>
<TR>
<TD>
<input name="btnFour" type="Button" value="  4  " onclick="NumPressed(4)">
</TD>
<TD>
<input name="btnFive" type="Button" value="  5  " onclick="NumPressed(5)">
</TD>
<TD>
<input name="btnSix" type="Button" value="  6  " onclick="NumPressed(6)">
</TD>
<TD>
</TD>
<TD align=middle><input name="btnPlus" type="Button" value="  +  " onclick="Operation('+')">
</TD>
<TD align=middle><input name="btnMinus" type="Button" value="   -   " onclick="Operation('-')">
</TD>
</TR>
<TR>
<TD>
<input name="btnOne" type="Button" value="  1  " onclick="NumPressed(1)">
</TD>
<TD>
<input name="btnTwo" type="Button" value="  2  " onclick="NumPressed(2)">
</TD>
<TD>
<input name="btnThree" type="Button" value="  3  " onclick="NumPressed(3)">
</TD>
<TD>
</TD>
<TD align=middle><input name="btnMultiply" type="Button" value="  *  " onclick="Operation('*')">
</TD>
<TD align=middle><input name="btnDivide" type="Button" value="   /   " onclick="Operation('/')">
</TD>
</TR>
<TR>
<TD>
<input name="btnZero" type="Button" value="  0  " onclick="NumPressed(0)">
</TD>
<TD>
<input name="btnDecimal" type="Button" value="   .  " onclick="Decimal()">
</TD>
<TD colspan=3>
</TD>
<TD>
<input name="btnEquals" type="Button" value="  =  " onclick="Operation('=')">
</TD>
</TR>
</TABLE>
</TABLE>
</B>
</FORM>
</CENTER>
<font face="Verdana, Arial, Helvetica" size=2>
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
var FKeyPad = document.Keypad;
var Accumulate = 0;
var FlagNewNum = false;
var PendingOp = "";
function NumPressed (Num) {
if (FlagNewNum) {
FKeyPad.ReadOut.value  = Num;
FlagNewNum = false;
   }
else {
if (FKeyPad.ReadOut.value == "0")
FKeyPad.ReadOut.value = Num;
else
FKeyPad.ReadOut.value += Num;
   }
}
function Operation (Op) {
var Readout = FKeyPad.ReadOut.value;
if (FlagNewNum && PendingOp != "=");
else
{
FlagNewNum = true;
if ( '+' == PendingOp )
Accumulate += parseFloat(Readout);
else if ( '-' == PendingOp )
Accumulate -= parseFloat(Readout);
else if ( '/' == PendingOp )
Accumulate /= parseFloat(Readout);
else if ( '*' == PendingOp )
Accumulate *= parseFloat(Readout);
else
Accumulate = parseFloat(Readout);
FKeyPad.ReadOut.value = Accumulate;
PendingOp = Op;
   }
}
function Decimal () {
var curReadOut = FKeyPad.ReadOut.value;
if (FlagNewNum) {
curReadOut = "0.";
FlagNewNum = false;
   }
else
{
if (curReadOut.indexOf(".") == -1)
curReadOut += ".";
   }
FKeyPad.ReadOut.value = curReadOut;
}
function ClearEntry () {
FKeyPad.ReadOut.value = "0";
FlagNewNum = true;
}
function Clear () {
Accumulate = 0;
PendingOp = "";
ClearEntry();
}
function Neg () {
FKeyPad.ReadOut.value = parseFloat(FKeyPad.ReadOut.value) * -1;
}
function Percent () {
FKeyPad.ReadOut.value = (parseFloat(FKeyPad.ReadOut.value) / 100) * parseFloat(Accumulate);
}
// End -->
</SCRIPT>
<font face="Tahoma"><a target="_blank" href="http://www.grabitin.blogspot.com/"><span style="font-size: 8pt; text-decoration: none">Grabitin</span></a></font>


Comments

Popular posts from this blog

10 Free Android Apps and Games you should use/play

Welcome guys, here we have 10 free android apps and games you might like.


Google Pixel 2 and Pixel 2 XL Announced, Price and Availability In India, US and more

Google Launched it's duo Pixel 2 and Pixel 2 XL in a event on 4th of October. The event was dynamic and included more announcement that just Pixel 2 smartphones which we will see later in this article.  




Google Pixel 2 and Pixel 2 XL pack the same specs except the display. The Google Pixel 2 sports a 1080p 5-inch AMOLED display on the other hand Pixel 2 XL sports a big 1440p 6-inch P-OLED DISPLAY. Both the 2017 Pixel smartphones are powered by Qualcomm Snapdragon 835 processor, coupled with 4GB of RAM.   

The first generation Pixel and Pixel XL device got 89 rating for it's camera from DXO Mark and this year the 2017 Pixel 2 and Pixel 2 XL got 98 DXO Mark. The duo feature a 12.2MP rear camera, f/1.8 aperture, Dual-LED flash and can shoot 4K videos, they have both OIS and EIS for stabilization. Yes, the pixel does not have a dual camera, Google is using a technology, in layman language, the an image will be from two angles which will give depth perception. 


With AI and ML Google h…

How to add Guest Book Widget For Blogger and Websites

Get Guest Book
All the website holders want to keep the visitors visit again and again. I have solution for that Copy the codes below and paste it where you want to paste it in your site and it acts as a Chat box for them with emoticons .
Steps to Add this widget to Your Blogger 1) Open Dashboard 2) Then Click LAYOUT 3) Click add Gadget >> HTML/Javascript 4) Copy the codes and Click Save 
DEMO

<script src="//www.gmodules.com/ig/ifr?url=http://scripts.tropicalpcsolutions.com/php/gadgets/guestbook/guestbook.xml&synd=open&w=285&h=240&title=Your+Title+Here&border=%23ffffff%7C3px%2C1px+solid+%23999999&output=js"></script>