Tuesday, 8 September 2015
THE ONLINE CALCULATOR CODE


-----------------------------------------------------------------------------------------------------------------
COPY AND PASTE BELOW CODE IN POST HTML SECTION
------------------------------------------------------------------------------------------------------------------
<html>
<head>
<title>Calculator Online</title>
<script type='text/javascript'>
//<![CDATA[
//flags to mark previous function
var opFlag=false //indicates previous entry was an operator
var eqFlag=false //indicates previous function was a calculation
function checkDec() {
//prevents multiple decimal points in entry
if (document.calc.screen.value.indexOf('.') == -1){
enterVal('.')
return
}
if ((document.calc.screen.value.indexOf('.') >= 0) && ((eqFlag) || (opFlag))){
enterVal('.')
return
}
}
function enterVal(num){
//determine how to handle entry based on previous function
if (eqFlag) {
//last entry gave a total, no operators entered, so replace both stores
document.calc.input.value=num
document.calc.screen.value=num
eqFlag=false
return
}
if ((!opFlag) && (!eqFlag)){
//no operators or totals entered, still entering numbers
document.calc.input.value += num
document.calc.screen.value += num
return
}
if (opFlag) {
//operator entered, change screen value, build on input
document.calc.screen.value =num
document.calc.input.value += num
opFlag=false
return
}
}
function compute() {
//if last entry is an operator, input is not complete so do nothing
len=document.calc.input.value.length
var oneChar=document.calc.input.value.charAt(len-1)
if ((oneChar == '+') || (oneChar == '-') || (oneChar == '*') ||
(oneChar == '/')) {
return
}
document.calc.screen.value = eval(document.calc.input.value)
document.calc.input.value = eval(document.calc.input.value)
eqFlag=true
}
function operator(op) {
//can't enter operator before entering a value
if (document.calc.screen.value == ''){
return
}
//if last entry is not an operator, use the one just entered
eqFlag=false
len=document.calc.input.value.length
var oneChar=document.calc.input.value.charAt(len-1)
if ((oneChar != '+') && (oneChar != '-') && (oneChar != '*') &&
(oneChar != '/') && (oneChar != '.')){
document.calc.screen.value = eval(document.calc.input.value)
document.calc.input.value = eval(document.calc.input.value)
document.calc.input.value += op
}
else {
//if last entry is an operator, replace it with this one
//this returns input store less operator
document.calc.input.value=parseFloat(document.calc.input.value)
document.calc.input.value+=op
}
opFlag=true
}
function clearAll() {
document.calc.input.value = ''
document.calc.screen.value=''
}
function clearEntry() {
//don't do anything if the last entry is not a number
len=document.calc.input.value.length
var oneChar=document.calc.input.value.charAt(len-1)
if ((oneChar == '+') || (oneChar == '-') || (oneChar == '*') ||
(oneChar == '/')) {
return
}
if (document.calc.screen.value == ''){
//nothing here to clear
return
}
if (document.calc.screen.value==document.calc.input.value) {
//only one entry, so clear it
document.calc.screen.value=''
document.calc.input.value=''
return
}
//get last number entered and clear it, return previous value to screen
str1=document.calc.screen.value
str2=document.calc.input.value
ind=str2.lastIndexOf(str1)
document.calc.input.value=document.calc.input.value.substring(0,ind)
document.calc.screen.value=parseFloat(document.calc.input.value)
}
function sqrRT() {
if (document.calc.input.value == ''){
//nothing entered, do nothing
return
}
document.calc.screen.value=Math.sqrt(document.calc.screen.value)
document.calc.input.value=document.calc.screen.value
eqFlag=true
}
function sqr() {
if (document.calc.input.value == ''){
return
}
document.calc.screen.value=(document.calc.screen.value)*(document.calc.screen.value)
document.calc.input.value=document.calc.screen.value
eqFlag=true
}
function neg() {//get last entry and negate it
str1=document.calc.screen.value
str2=document.calc.input.value
ind=str2.lastIndexOf(str1)
document.calc.input.value=document.calc.input.value.substring(0,ind)
document.calc.screen.value=(document.calc.screen.value)*-1
document.calc.input.value += "(" + document.calc.screen.value + ")"
//placed in () to solve double operator problem
}
function pcnt() {
if (document.calc.input.value == ''){ //nothing here
return
}
//if last entry is an operator, do nothing
len=document.calc.input.value.length
var oneChar=document.calc.input.value.charAt(len-1)
if ((oneChar == '+') || (oneChar == '-') || (oneChar == '*') ||
(oneChar == '/')) {
return
}
//check that there are two numbers entered
if ((document.calc.input.value.indexOf('+') == -1)&&
(document.calc.input.value.indexOf('-') == -1)&&
(document.calc.input.value.indexOf('*') == -1)&&
(document.calc.input.value.indexOf('/') == -1)){
return
}
//calculate percentage
if ((document.calc.input.value.indexOf('+') != -1) ||
(document.calc.input.value.indexOf('-') != -1)) {
percent=((document.calc.screen.value)/100)*parseFloat(document.calc.input.value)
}
else {
percent=((document.calc.screen.value)/100)
}
//replace last entry with percentage and evaluate expression
str1=document.calc.screen.value
str2=document.calc.input.value
ind=str2.lastIndexOf(str1)
document.calc.input.value=document.calc.input.value.substring(0,ind)
document.calc.input.value+=percent
document.calc.screen.value = eval(document.calc.input.value)
document.calc.input.value = eval(document.calc.input.value)
eqFlag=true
}
function memory_p() {
if (document.calc.screen.value ==''){
return
}
//add screen value to memory store
document.calc.memory.value+= "+" + document.calc.screen.value
document.calc.memory.value=eval(document.calc.memory.value)
eqFlag=true
document.calc.mem_win.value='M' //indicator of something in memory
}
function memory_s() {
if (document.calc.screen.value ==''){
return
}
document.calc.memory.value += "-(" + (document.calc.screen.value) +")"
document.calc.memory.value=eval(document.calc.memory.value)
eqFlag=1
document.calc.mem_win.value='M'
}
function memory_r() {
//recall memory store to screen
document.calc.screen.value=''
enterVal(document.calc.memory.value)
eqFlag=true
}
function memory_c() {
//clear memory indicator
document.calc.memory.value=0
document.calc.mem_win.value=''
}
function constant(what) {
if (what == 'pi') {
document.calc.screen.value=''
enterVal(Math.PI)
eqFlag=true
}
}
//]]>
</script>
</head>
<body>
<form name="calc" id="calc" action="index.htm" style="margin:0; padding:0;">
<h1 align="center">The Online Calculator</h1>
<table border="5" cellpadding="0" cellspacing="0" align="center"background="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhIQ880_LgZX9_9VHMxBpmHB5STwjyeqBAd5QOCvHm0Ztkg0mLvVy3ilYPeH6q7PxAEvtbEkJoLJ3QOHqyDGm3ilz2qKo3-HtVBDoysqE3tcYVqkhjuzt7iUNapJ37EOCZxt_IKMZ7Sz3w4/w550-h250-no/11700798_449077528586911_7615001439496110272_n.png">
<tr valign="middle" align="center">
<td><table border="0" cellspacing="0" cellpadding="4">
<tr>
<td><input type="text" class="none" name="mem_win" size="1" value='' /></td>
<td align="right" width="100%"><input type="text" class="none" name="screen" size="30" style="font-family:'Comic Sans MS'; font-weight: bold; background:url(data:image/gif;base64,R0lGODlhsQBfALMAAO+9jPe9iP+9e/+9hOLBn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8cgNkRCBKrTcqgBAsTIMcSwQ5JaL7RDaOtvtuuy2O0EEAAA7" /></td>
</tr>
</table></td>
</tr>
<tr>
<td style="padding:4px;"><table border="0" align="center" cellspacing="0" cellpadding="4">
<tr align="center">
<td><input type="button" class="button" style="font-size:2em;" font-weight: Bold; name="mem_c" value="MC" onclick="memory_c()" /></td>
<td><input type="button" class="button" style="font-size:2em;" font-weight: Bold; name="mem_p" value="M+" onclick="memory_p()" /></td>
<td><input type="button" class="button" style="font-size:2em;" font-weight: Bold; name="mem_s" value="M−" onclick="memory_s()" /></td>
<td><input type="button" class="button" style="font-size:2em;" font-weight: Bold; name="mem_r" value="MR" onclick="memory_r()" /></td>
</tr>
<tr align="center">
<td><input type="button" class="button" style="width:2em; height:1.4em; font-size:2em;" font-weight: Bold; name="SQROOT" value="²√" onclick="sqrRT()" /></td>
<td><input type="button" class="button" style="width:2em; height:1.4em; font-size:2em;" font-weight: Bold; name="SQUARE" value="x²" onclick="sqr()" /></td>
<td><input type="button" class="button" style="width:2em; height:1.4em; font-size:2em;" font-weight: Bold; name="PERCENT" value="%" onclick="pcnt()" /></td>
<td><input type="button" class="button_pi" style="width:2em; height:1.4em; font-size:2em;" font-weight: Bold; name="pi" value="π" onclick="constant('pi')" /></td>
</tr>
<tr align="center">
<td><input type="button"class="button" style="font-size:2em;" font-weight: Bold; name="ONE" value=" 1 " onClick="enterVal('1')"></td>
<td><input type="button"class="button" style="font-size:2em;" font-weight: Bold; name="TWO" value=" 2 " onClick="enterVal('2')"></td>
<td><input type="button"class="button" style="font-size:2em;" font-weight: Bold; name="THREE" value=" 3 " onClick="enterVal('3')"></td>
<td><input type="button" class="button" style="font-size:2em;" font-weight: Bold; name="PLUS" value=" + " onclick="operator('+')" /></td>
</tr>
<tr align="center">
<td><input type="button"class="button" style="font-size:2em;" font-weight: Bold; name="FOUR" value=" 4 " onClick="enterVal('4')"></td>
<td><input type="button"class="button" style="font-size:2em;" font-weight: Bold; name="FIVE" value=" 5 " onClick="enterVal('5')"></td>
<td><input type="button"class="button" style="font-size:2em;" font-weight: Bold; name="SIX" value=" 6 " onClick="enterVal('6')"></td>
<td><input type="button" class="button" style="font-size:2em;" font-weight: Bold; name="MINUS" value=" - " onclick="operator('+')" /></td>
</tr>
<tr align="center">
<td><input type="button"class="button" style="font-size:2em;" font-weight: Bold; name="SEVEN" value=" 7 " onClick="enterVal('7')"></td>
<td><input type="button"class="button" style="font-size:2em;" font-weight: Bold; name="EIGHT" value=" 8 " onClick="enterVal('8')"></td>
<td><input type="button"class="button" style="font-size:2em;" font-weight: Bold; name="NINE" value=" 9 " onClick="enterVal('9')"></td>
<td><input type="button" class="button" style="font-size:2em;" font-weight: Bold; name="MINUS" value=" * " onclick="operator('*')" /></td>
</tr>
<tr align="center">
<td><input type="button" class="button" style="width:2em; height:1.4em; font-size:2em;" font-weight: Bold; name="CLEAR" value="C" onclick="clearAll()" /></td>
<td><input type="button" class="button" style="width:2em; height:1.4em; font-size:2em;" font-weight: Bold; name="CE" value=" CE " onclick="clearAll()" /></td>
<td><input type="button" class="button" style="width:2em; height:1.4em; font-size:2em;" font-weight: Bold; name="NEGATE" value="+/-" onclick="neg()" /></td>
<td><input type="button" class="button" style="width:2em; height:1.4em; font-size:2em;" font-weight: Bold; name="DIVISION" value="/" onclick="operator('/')" /></td>
</tr>
<tr align="center">
<td><input type="button" style="width:2em; height:1.4em; font-size:2em;" font-weight: Bold; name="ZERO" value=" 0 " onClick="enterVal('0')"></td>
<td><input type="button" style="width:2em; height:1.4em; font-size:2em;" font-weight: Bold; name="DECI" value=" . " onClick="checkDec()"></td>
<td><input type="button" style="width:2em; height:1.4em; font-size:2em;" font-weight: Bold; name="DOLT" value=" = " onClick="compute()"></td>
<td><input type="button" style="width:2em; height:1.6em; font-size:2em; background: #F7F6F6 url(data:image/gif;base64,R0lGODlhPAAyAIUAAAAAAAEDAAcNAA8OAAoRABEdAB8eABUkABwvAC8uACI6AD8+ACxKADRXAE9OADxkAEBsAF9dAEV0AE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hdGVkIG9yIG1vZGlmaWVkIGJ5DQpTVEVWRSBNQ0RBTklFTA0KKFN0ZXZlIE1jRGFuaWVsKQ0KSUJNIENvcnBvcmF0aW9uDQoNCkNyZWF0ZWQgYnkgQWxjaGVteSBNaW5kd29ya3MnDQpHSUYgQ29uc3RydWN0aW9uIFNldCBQcm9mZXNzaW9uYWwNCmh0dHA6Ly93d3cubWluZHdvcmtzaG9wLmNvbQAh/wtHSUZDT050YjEuMAICAA4RAAYAAQAAAAAAAAAAABFaOlxlbnZlbG9wZTIuZ2lmAA4RAAYAAgAAAAAAAAAAABFaOlxlbnZlbG9wZTEuZ2lmAAA7) repeat-x 0 0;" font-weight: Bold; name="DOLT" value="" onClick="LOVE"></td>
</tr>
</table></td></tr></table>
<input type="hidden" name="input" size="16" />
<input type="hidden" name="memory" value="0" size="16" />
</form>
</body>
</html>
Related movie you might like to see :

COMMENTS REMOVER CODE

COMMENTS REMOVER

FILE SAVE AS WITH JAVA SCRIPT METHO...

FILE SAVE AS WITH JAVA SCRIPT METH...

HTML CSS JAVA COMPRESSOR CODE

HTML CSS JAVA COMPRESSOR

ONLINE CSS UNMINIFIER CODE

ONLINE CSS UNMINIFIER

CSSO (CSS Optimizer)

SCRIPT TUTORIALS CSSO CSS COMPOSER ...

WHITE SPACE REMOVER CODE

White Space Remover
?
+
X
Recommended for you
Loading..
Related Post for THE ONLINE CALCULATOR CODE
LINEAR EQUATION CALCULATOR #parse_btn { background-color:Blue; color:#FFFFFF; font-size:30px; width:200px; height:50px; } x=3;y=7 Calculate it! Solve Graph Lesson Sh…
PRIME FACTORS BRANCH CALCULATOR CODE ----------------------------------------------------------------------------------------------------------------- COPY AND PASTE BELOW CODE IN POST HTML SECTION ---------------…
PRIME FACTORS BRANCH CALCULATOR PRIME FACTORS /* AngularJS v1.2.20 (c) 2010-2014 Google, Inc. http://angularjs.org License: MIT */ (function(S,U,s){'use strict';function v(b){return function(){var …
URDU TYPE WRITER CODE ----------------------------------------------------------------------------------------------------------------- COPY AND PASTE BELOW CODE IN POST HTML SECTION --------------…
HOW MANY DIVISORS DOES A NUMBER HAVE? -------------------------------------------------------------------------------------------------------------------------- READ MORE: http://www.javascripter.net/math/calculat…
DATA URI CODE IMAGE CONVERT INTO JPG IMAGE Best Online Base64 to Image converter .arrow_box { position: relative; background: #ffffff; border: 4px solid #E9E9E9; } .arrow_box:after,.arrow_box:before { top: 100%; lef…
HCF AND LCM WITH BRACH METHOD CALCULATOR HIGHEST COMMON FACTOR AND LOWEST COMMON MULTIPLE /* AngularJS v1.2.20 (c) 2010-2014 Google, Inc. http://angularjs.org License: MIT */ (function(S,U,s){'use strict';fu…
URDU TYPE WRITER Urdu keyboard Online .bt {cursor:pointer; width:32pt; font-size:20pt; color:#CC0033; font-family:'Times New Roman'; } .bta {cursor:pointer; width:38pt; font-size:20pt; …
HCF AND LCM WITH BRACH METHOD CALCULATOR CODE ----------------------------------------------------------------------------------------------------------------- COPY AND PASTE BELOW CODE IN POST HTML SECTION ---------------…
GREATEST COMMON FACTOR CALCULATOR CODE -------------------------------------------------------------------------------------------------------------------------- READ MORE: http://maths.wordpandit.com/h-c-f-by-…
HOW MANY DIVISORS DOES A NUMBER HAVE? -------------------------------------------------------------------------------------------------------------------------- READ MORE: http://primes.utm.edu/glossary/xpage/tau.…
LINEAR EQUATION CALCULATOR CODE ----------------------------------------------------------------------------------------------------------------- COPY AND PASTE BELOW CODE IN POST HTML SECTION ---------------…
Labels:
TEXT TOOLS
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment
Click to see the code!
To insert emoticon you must added at least one space before the code.