Version compl�te: jsB@nk » Calcul » Calculatrice » Calculatrice de base JavaScript
URL: https://www.javascriptbank.com/basic-javascript-calculator.html
Un autre script fait une calculatrice basique.
Version compl�te: jsB@nk » Calcul » Calculatrice » Calculatrice de base JavaScript
URL: https://www.javascriptbank.com/basic-javascript-calculator.html
<script language="JavaScript"><!-- hidefunction calculation7() { document.calculator.display1.value= document.calculator.display1.value+7}function calculation8() { document.calculator.display1.value=document.calculator.display1.value+8}function calculation9() { document.calculator.display1.value= document.calculator.display1.value+9}function calculation4() { document.calculator.display1.value=document.calculator.display1.value+4}function calculation5() { document.calculator.display1.value= document.calculator.display1.value+5}function calculation6() { document.calculator.display1.value=document.calculator.display1.value+6}function calculation1() { document.calculator.display1.value= document.calculator.display1.value+1}function calculation2() { document.calculator.display1.value=document.calculator.display1.value+2}function calculation3() { document.calculator.display1.value= document.calculator.display1.value+3}function calculationtimes() { document.calculator.display1.value= document.calculator.display1.value+"*"}function calculationadd() { document.calculator.display1.value= document.calculator.display1.value+"+"}function calculationdivide() { document.calculator.display1.value= document.calculator.display1.value+"/"}function calculationpi() { document.calculator.display1.value= document.calculator.display1.value +3.1415926535897932384626433832795}function calculationdot() { document.calculator.display1.value= document.calculator.display1.value+"."}function calculationminus() { document.calculator.display1.value= document.calculator.display1.value+"-"}function calculationbrac2() { document.calculator.display1.value= document.calculator.display1.value+")"}function calculationbrac() { document.calculator.display1.value= document.calculator.display1.value+"("}function calculationsqr() {document.calculator.display2.value=(" The Sqr Root of " + document.calculator.display1.value + " is ")document.calculator.display1.value=Math.sqrt(document.calculator.display1.value) }function calculationpower() { document.calculator.display2.value=document.calculator.display1.value+"^"+document.calculator.display1.valuevar power1=document.calculator.display1.value * document.calculator.display1.valuedocument.calculator.display1.value=power1}function calculationzero() { document.calculator.display1.value=document.calculator.display1.value+"0"}function calculationclear() { document.calculator.display1.value=""document.calculator.display2.value=""}function calculationequal() { answer=eval(document.calculator.display1.value)document.calculator.display2.value=document.calculator.display1.valuedocument.calculator.display1.value=answer}function calculationsin(form) {document.calculator.display2.value= " Sin " + document.calculator.display1.value document.calculator.display1.value = Math.sin(document.calculator.display1.value);}function calculationcos(form) {document.calculator.display2.value= " Cos " + document.calculator.display1.value document.calculator.display1.value = Math.cos(document.calculator.display1.value);}function calculationtan(form) {document.calculator.display2.value= " Tan " + document.calculator.display1.value document.calculator.display1.value = Math.tan(document.calculator.display1.value);}function calculationasin(form) {document.calculator.display2.value= " -Sin " + document.calculator.display1.value document.calculator.display1.value = Math.asin(document.calculator.display1.value);}function calculationacos(form) {document.calculator.display2.value= " -Cos " + document.calculator.display1.value document.calculator.display1.value = Math.acos(document.calculator.display1.value);}function calculationatan(form) {document.calculator.display2.value= " -Tan " + document.calculator.display1.value document.calculator.display1.value = Math.atan(document.calculator.display1.value);}// --></script><!-- This script downloaded from www.JavaScriptBank.com Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->
<table bgcolor="silver" cellpadding="10" border="3" bordercolor="gray"><tbody><tr><td><b><i>Basic JavaScript Calculator v1.0</i> </b><form name="calculator"><input type="text" name="display2" size="40"><br>=<br><input type="text" name="display1" size="40"><br><input type="button" value="7" onclick="calculation7()" button="" style="width: 70px;"><input type="button" value="8" onclick="calculation8()" button="" style="width: 70px;"><input type="button" value="9" onclick="calculation9()" button="" style="width: 70px;"><input type="button" value="/" onclick="calculationdivide()" button="" style="width: 70px;"><br><input type="button" value="4" onclick="calculation4()" button="" style="width: 70px;"><input type="button" value="5" onclick="calculation5()" button="" style="width: 70px;"><input type="button" value="6" onclick="calculation6()" button="" style="width: 70px;"><input type="button" value="x" onclick="calculationtimes()" button="" style="width: 70px;"><br><input type="button" value="1" onclick="calculation1()" button="" style="width: 70px;"><input type="button" value="2" onclick="calculation2()" button="" style="width: 70px;"><input type="button" value="3" onclick="calculation3()" button="" style="width: 70px;"><input type="button" value="-" onclick="calculationminus()" button="" style="width: 70px;"><br><input type="button" value="=" onclick="calculationequal()" button="" style="width: 70px;"><input type="button" value="0" onclick="calculationzero()" button="" style="width: 70px;"><input type="button" value="." onclick="calculationdot()" button="" style="width: 70px;"><input type="button" value="+" onclick="calculationadd()" button="" style="width: 70px;"><br><input type="button" value="Clear" onclick="calculationclear()" button="" style="width: 70px;"><input type="button" value="(" onclick="calculationbrac()" button="" style="width: 70px;"><input type="button" value=")" onclick="calculationbrac2()" button="" style="width: 70px;"><input type="button" value="^" onclick="calculationpower()" button="" style="width: 70px;"><br><input type="button" value="Sqr" onclick="calculationsqr()" button="" style="width: 70px;"><input type="button" value="sin" onclick="calculationsin()" button="" style="width: 70px;"><input type="button" value="cos" onclick="calculationcos()" button="" style="width: 70px;"><input type="button" value="tan" onclick="calculationtan()" button="" style="width: 70px;"><br><input type="button" value="-sin" onclick="calculationasin()" button="" style="width: 70px;"><input type="button" value="-cos" onclick="calculationacos()" button="" style="width: 70px;"><input type="button" value="-tan" onclick="calculationatan()" button="" style="width: 70px;"><input type="button" value="pi" onclick="calculationpi()" button="" style="width: 70px;"><div align="right">By James Block <a href="mailto:[email protected]">[email protected]</a></div></form></td></tr></tbody></table><!-- This script downloaded from www.JavaScriptBank.com Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->