Javascript Square root Calculator

 This javascript square root calculator is used to calculate square root of a number. This squareroot calculator is for free use.

Features

  • You can calculate square root of any number using this javascript calculator.
  • This is a free square root calculator.
  • Just copy the code and use it.

Preview


Square root-Calculator

Enter a Number :

 
The SqureRoot :
©hscripts.com

Downloads

Javascript code

<!-- Script by hscripts.com -->
<script type="text/javascript">
function sqr(num)
{
var no=parseFloat(num.value);
if(isNaN(no))
{
alert("Please Enter Numbers Only");
num.value="";
document.frm.res.value="";
num.focus();
}
else
{
document.frm.res.value=Math.sqrt(no).toFixed(2);
} } function incheck(event,no) {
var kc;
if(window.event)
{
kc=event.keyCode;
}
else
{
kc=event.which;
}
var num=no.value;
if(kc==46)
{
if(num.indexOf(".")==-1)
{
return true;
}
else
{
return false;
}
}
if(kc==48)
{
if(num.indexOf("-")==0 && num.length==1)
{
return false;
}
if(num=="")
{
return false;
}
else
{
return true;
}
}if (kc!=8 && kc!=0)
{
if (kc<49||kc>57)
{
return false;
}
}
} </script>
<!-- Script by hscripts.com -->

HTML Code
<form name="frm">
Enter a Number :<input type="text" name="number" onkeypress="return
incheck(event,number)">
<input type="button" value="SqureRoot" onclick="sqr(number)">
The SqureRoot :<input type="text" name="res" readonly>
©<a href="http://hscripts.com">hscripts.com</a>
</form>
  • Release Date - 07-04-2008
  • Get free version without ©copyright link for just $5/-
  • For customization of this script or any script development, mail to support@hscripts.com

Usage

  • He we have explained with a form
  • Create the form using following HTML code
  • <form name="frm">
        Enter a Number :<input type="text" name="number" onkeypress="return   incheck(event,number)">
        <input type="button" value="SqureRoot" onclick="sqr(number)">
        The SquareRoot :<input type="text" name="res" readonly>
       ©<a href="http://hscripts.com">hscripts.com</a>
        </form>
  • The javascript function sqr() is triggered, when the button is clicked.
  • Just copy the javascript code and use it for free.

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