Full version: jsB@nk » Calculation » Calculator » Hi Tech Calculator
URL: https://www.javascriptbank.com/hi-tech-calculator.html
This is a different script to create a calculator code with memorial function.
Full version: jsB@nk » Calculation » Calculator » Hi Tech Calculator
URL: https://www.javascriptbank.com/hi-tech-calculator.html
<style type="text/css"><!-- input{font-family:courier; font-size:12pt}--></style><!-- This script downloaded from www.JavaScriptBank.com Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->
<script language="javascript"><!--/*************************************************************************** This script copyright 2000 Jim Porter ********** Email: [email protected] ********** Site: http://www.thesoyokaze.net/thespamfiles/ ***************************************************************************//*************************************************************************** NOTE... ********** rnd stands for "round" ********** asi, aco, and ata stand for "asin", "acos", and "atan" ********** sto stands for "store", rcl stands for "recall" ********** clr clears the screen, and ans recalls the last answer ***************************************************************************/currentoperation="";answer="";stored="";function RoundforError(number){return (Math.round(number*10000000000))/10000000000; }function WriteText(text){document.calculator.output.value+=text; currentoperation+=text; }function Equals(){answer=RoundforError(eval(currentoperation)); document.calculator.output.value+="\n"+answer+"\n"; currentoperation=""; }function Clear(){document.calculator.output.value=""; currentoperation=""; }function Store(){stored=answer; }function pi(){return 3.14159265358979323846264338327850; }//--></script><!-- This script downloaded from www.JavaScriptBank.com Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->
<form name="calculator"><table cellspacing="0" cellpadding="0" border="0"><tbody><tr> <td valign="bottom"><font face="Courier"><input type="button" value="rnd" onclick="WriteText('Math.round(');"><br><input type="button" value="exp" onclick="WriteText('Math.exp(');"><br><input type="button" value="log" onclick="WriteText('Math.log(');"><br><input type="button" value="sin" onclick="WriteText('Math.sin(');"><br><input type="button" value="cos" onclick="WriteText('Math.cos(');"><br><input type="button" value="tan" onclick="WriteText('Math.tan(');"></font></td> <td colspan="5" valign="bottom"><center><textarea wrap="virtual" rows="8" cols="22" name="output" onfocus="document.calculator.output.blur();"></textarea></center></td> <td valign="bottom"><font face="Courier"><input type="button" value="pi " onclick="WriteText('pi()');"><br><input type="button" value="int" onclick="WriteText('Math.int(');"><br><input type="button" value="abs" onclick="WriteText('Math.abs(');"><br><input type="button" value="flr" onclick="WriteText('Math.floor(');"><br><input type="button" value="cel" onclick="WriteText('Math.ceil(');"><br><input type="button" value="sqt" onclick="WriteText('Math.sqrt(');"></font></td></tr><tr> <td><font face="Courier"><input type="button" value="asi" onclick="WriteText('Math.asin(');"></font></td> <td><font face="Courier"><input type="button" value=" , " onclick="WriteText(',');"></font></td> <td><font face="Courier"><input type="button" value=" 7 " onclick="WriteText('7');"></font></td> <td><font face="Courier"><input type="button" value=" 8 " onclick="WriteText('8');"></font></td> <td><font face="Courier"><input type="button" value=" 9 " onclick="WriteText('9');"></font></td> <td><font face="Courier"><input type="button" value=" + " onclick="WriteText('+');"></font></td> <td><font face="Courier"><input type="button" value="pow" onclick="WriteText('Math.pow(');"></font></td></tr><tr> <td><font face="Courier"><input type="button" value="aco" onclick="WriteText('Math.acos(');"></font></td> <td><font face="Courier"><input type="button" value="Clr" onclick="Clear();"></font></td> <td><font face="Courier"><input type="button" value=" 4 " onclick="WriteText('4');"></font></td> <td><font face="Courier"><input type="button" value=" 5 " onclick="WriteText('5');"></font></td> <td><font face="Courier"><input type="button" value=" 6 " onclick="WriteText('6');"></font></td> <td><font face="Courier"><input type="button" value=" - " onclick="WriteText('-');"></font></td> <td><font face="Courier"><input type="button" value=" % " onclick="WriteText('%');"></font></td></tr><tr> <td><font face="Courier"><input type="button" value="ata" onclick="WriteText('Math.atan(');"></font></td> <td><font face="Courier"><input type="button" value="Ans" onclick="WriteText(answer);"></font></td> <td><font face="Courier"><input type="button" value=" 1 " onclick="WriteText('1');"></font></td> <td><font face="Courier"><input type="button" value=" 2 " onclick="WriteText('2');"></font></td> <td><font face="Courier"><input type="button" value=" 3 " onclick="WriteText('3');"></font></td> <td><font face="Courier"><input type="button" value=" * " onclick="WriteText('*');"></font></td> <td><font face="Courier"><input type="button" value=" ( " onclick="WriteText('(');"></font></td></tr><tr> <td><font face="Courier"><input type="button" value="Sto" onclick="Store();"></font></td> <td><font face="Courier"><input type="button" value="Rcl" onclick="WriteText(stored);"></font></td> <td><font face="Courier"><input type="button" value=" = " onclick="Equals();"></font></td> <td><font face="Courier"><input type="button" value=" . " onclick="WriteText('.');"></font></td> <td><font face="Courier"><input type="button" value=" 0 " onclick="WriteText('0');"></font></td> <td><font face="Courier"><input type="button" value=" / " onclick="WriteText('/');"></font></td> <td><font face="Courier"><input type="button" value=" ) " onclick="WriteText(')');"></font></td></tr></tbody></table></form><!-- This script downloaded from www.JavaScriptBank.com Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->