»
EnglishFrenchVietnamese

Print - My Calculator - JavaScriptBank.com

Full version: jsB@nk » Calculation » Calculator » My Calculator
URL: https://www.javascriptbank.com/my-calculator.html

My Calculator © JavaScriptBank.comThis is a different script to make the basic calculator.

Full version: jsB@nk » Calculation » Calculator » My Calculator
URL: https://www.javascriptbank.com/my-calculator.html



JavaScript
<script language="Javascript">function calc (ch){       if  (ch == "=") {    document.form1.text1.value  =    eval ( document.form1.text1.value ) ;       }else{if ( ch  ==  "C" ){        document.form1.text1.value  = "" ;}else{        document.form1.text1.value  +=  ch ;}}}</script><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->


HTML
<form name="form1"><input type="text" name="text1" value="" size="36"> <div align="center">  <center><table width="175" style="border-collapse: collapse;" bordercolor="#111111" cellpadding="2" cellspacing="2"><tbody><tr><td width="117"><input type="button" value=" 7 " onclick="calc('7')"></td><td width="145"><input type="button" value=" 8 " onclick="calc('8')"></td><td width="151"><input type="button" value=" 9 " onclick="calc('9')"></td><td width="216"><input type="button" value=" * " onclick="calc('*')"></td></tr><tr><td width="117"><input type="button" value=" 4 " onclick="calc('4')"></td><td width="145"><input type="button" value=" 5 " onclick="calc('5')"></td><td width="151"><input type="button" value=" 6 " onclick="calc('6')"></td><td width="216"><input type="button" value=" / " onclick="calc('/')"></td></tr><tr><td width="117"><input type="button" value=" 1 " onclick="calc('1')"></td><td width="145"><input type="button" value=" 2 " onclick="calc('2')"></td><td width="151"><input type="button" value=" 3 " onclick="calc('3')"></td><td width="216"><input type="button" value=" - " onclick="calc('-')"></td></tr><tr><td width="117"><input type="button" value=" 0 " onclick="calc('0')"></td><td width="145"><input type="button" value=" c" onclick="calc('C')"></td><td width="151"><input type="button" value=" = " onclick="calc('=')"></td><td width="216"><input type="button" value=" + " onclick="calc('+')"></td></tr><tr><td width="117"><input type="button" value="(  " onclick="calc('(')"></td><td width="145"><input type="button" value=") " onclick="calc(')')"></td><td width="145"><input type="button" value=" 100" onclick="calc('100')"></td><td width="145"><input type="button" value=".01 " onclick="calc('.01')"></td></tr></tbody></table>  </center></div></form><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->