close
The Wayback Machine - https://web.archive.org/web/20150317164649/https://www.hscripts.com/scripts/JavaScript/scientific.php

Javascript Scientific Calculator

This javascript scientific calculator is used to perform mathematical operations like sin,cos,tan,log,exp,square,squareroot.You can use this calculator to make calculations.

Features

  • You can do mathematical operations using this calculator.
  • This calculator is also used to find log, exp, sin, cos, tan operations and for other basic calculations.
  • This is free javascript calculator.

Preview

Scientific-Calculator


Degrees Radians H

Downloads

<!--Scripts by hscripts.com-->
<!--More scripts @ www.hscripts.com-->
<script type="text/javascript">
var temp;
function w_onload()
{frm.txt.value=0;
}
function addchar(input,character)
{
if(input.value == null || input.value == "0")input.value = characterelseinput.value += character
}
function cancel_click()
{frm.txt.value=0;
}
function sin_click(obj)
{if(obj=='sin')var result=frm.txt.value;if(document.frm.deg[0].checked){result=result*Math.PI/180;frm.txt.value=Math.sin(result).toFixed(2);}if(document.frm.deg[1].checked)frm.txt.value=Math.sin(result).toFixed(2);
}
function cos_click(obj)
{if(obj=='cos')var result=frm.txt.value;if(document.frm.deg[0].checked){result=result*Math.PI/180;frm.txt.value=Math.cos(result).toFixed(2);}if(document.frm.deg[1].checked)frm.txt.value=Math.cos(frm.txt.value);
}
function tan_click(obj)
{if(obj=='tan')var result=frm.txt.value;if(document.frm.deg[0].checked){result=result*Math.PI/180;frm.txt.value=Math.tan(result).toFixed(2);}if(document.frm.deg[1].checked)frm.txt.value=Math.tan(frm.txt.value);
}
function resi_click()
{temp= frm.txt.value;frm.txt.value=1/temp;
}
function log_click()
{frm.txt.value=Math.log(frm.txt.value)/Math.LN10;
}
function sqr_click()
{temp=frm.txt.value;frm.txt.value=temp*temp;
}
function sqrt_click()
{frm.txt.value=Math.sqrt(frm.txt.value);
}
function equal_click()
{frm.txt.value=eval(frm.txt.value);
}
function exp_click()
{frm.txt.value=Math.exp(frm.txt.value);
}
function fac_click()
{var f=1;var i;var n=parseInt(frm.txt.value);for(i=1;i<=n;i++){f=f*i;}frm.txt.value=f;
}
function bks_click()
{var s;s=frm.txt.value;if(s>=1){var b=s.substr(0,s.length-1);frm.txt.value=b;}
}
function sign_click()
{if(isNaN(frm.txt.value)==false){if(frm.txt.value>0){ frm.txt.value=frm.txt.value*-1}else if(frm.txt.value<0){ frm.txt.value=frm.txt.value.replace('-','')}}
}
function ln_click()
{frm.txt.value=Math.log(frm.txt.value);
}
function lb_click()
{frm.txt.value=Math.log(frm.txt.value)/Math.LN2;
}
</script><body onload="w_onload()">
<form name="frm" action="">
<center>
<table style="border:solid green 1px">
<tr>
<td>
<input type="text" maxlength="10" name="txt" size="31"><br>
</td>
</tr>
<tr>
<td>
<font size=1.5px><input type="radio" name=deg value="Degree">Degrees</input>
<input type="radio" name=deg
value="Radian" checked>Radians</input>
<a style="text-decoration:none;" href="https://www.hscripts.com">   H</a></font>
</td></tr>
<tr>
<td>
<input type="button" name="sqr" value="sqr" style="width:30px;height:32px" onclick="sqr_click()">
<input type="button" name="sqt" value="sqt" style="width:30px;height:32px" onclick="sqrt_click()">
<input type="button" name="exp" value="exp" style="width:30px;height:32px" onclick="exp_click()">
<input type="button" name="fac" value="x!" style="width:30px;height:32px" onclick="fac_click()">
<input type="button" name="bks" value="bks" style="width:30px;height:32px" onclick="bks_click()">
<input type="button" name="cancel" value="clr" style="width:30px;height:32px" onclick="cancel_click()">
</td></tr>
<tr>
<td>
<input type="button" name="one" value="1" style="width:30px;height:32px" onclick="addchar(this.form.txt,'1')">
<input type="button" name="two" value="2" style="width:30px;height:32px" onclick="addchar(this.form.txt,'2')">
<input type="button" name="three" value="3" style="width:30px;height:32px" onclick="addchar(this.form.txt,'3')">
<input type="button" name="add" value="+" style="width:30px;height:32px" onclick="addchar(this.form.txt,'+')">
<input type="button" name="sin" value="sin" style="width:30px;height:32px" onclick="sin_click('sin')">
<input type="button" name="log" value="log" style="width:30px;height:32px" onclick="log_click()">
</td></tr>
<tr>
<td>
<input type="button" name="four" value="4" style="width:30px;height:32px" onclick="addchar(this.form.txt,'4')">
<input type="button" name="five" value="5" style="width:30px;height:32px" onclick="addchar(this.form.txt,'5')">
<input type="button" name="six" value="6" style="width:30px;height:32px" onclick="addchar(this.form.txt,'6')">
<input type="button" name="sub" value="-" style="width:30px;height:32px" onclick="addchar(this.form.txt,'-')">
<input type="button" name="cos" value="cos" style="width:30px;height:32px" onclick="cos_click('cos')">
<input type="button" name="ln" value="ln" style="width:32px;height:32px" onclick="ln_click()">
</td></tr>
<tr>
<td>
<input type="button" name="seven" value="7" style="width:30px;height:32px" onclick="addchar(this.form.txt,'7')">
<input type="button" name="eight" value="8" style="width:30px;height:32px" onclick="addchar(this.form.txt,'8')">
<input type="button" name="nine" value="9" style="width:30px;height:32px" onclick="addchar(this.form.txt,'9')">
<input type="button" name="mul" value="*" style="width:30px;height:32px" onclick="addchar(this.form.txt,'*')">
<input type="button" name="tan" value="tan" style="width:30px;height=32px" onclick="tan_click('tan')">
<input type="button" name="lb" value="lb" style="width:30px;height:32px" onclick="lb_click()">
</td></tr>
<tr>
<td>
<input type="button" name="zero" value="0" style="width:30px;height:32px" onclick="addchar(this.form.txt,'0')">
<input type="button" name="dot" value="." style="width:30px;height:32px" onclick="addchar(this.form.txt,'.')">
<input type="button" name="equal" value="=" style="width:30px;height:32px" onclick="equal_click()">
<input type="button" name="div" value="/" style="width:30px;height:32px" onclick="addchar(this.form.txt,'/')">
<input type="button" name="sign" value="+/-" style="width:30px;height:32px" onclick="sign_click()">
<input type="button" name="resi" value="1/x" style="width:30px;height:32px" onclick="resi_click()">
</td></tr>
</table>
</center>
</form>
</body>
<!--Scripts by hscripts.com-->
  • Get free version without ©copyright link for just $5/-
  • For customization of this script or any script development, mail to support@hscripts.com

Usage

  • This is free scientific calculator.
  • By using this you can perform mathematical operations.
  • Just copy the above code and use it in your web page.
  • Make sure that you can use the calc-func() page properly.

License

  • The javascript (misspelled as java script) is given under GPL License.
  • i.e. Free use for those who use it as it is.
  • Free, if your modification does not remove our copyright information and links.
  • Detailed License information can be found here.
  • You can purchase the script if your requirements does not meet GPL License terms.

Related Scripts

Free Javascript Scripts