JavaScript Scripts





Español Français 中文 Deutsch Portuguese Japanese nederlands
   
 
Free Java Script Codes
Javascript List All
Slide Show Slide Show
Ad Display Ad Display
Image Effect Image Effect
Animated Image Effects Animated Image Effects
Form Validation Form Validation
Color Picker Tool Color Picker Tool
Formatting Forms Formatting Forms
Select All Select All
Dynamic Form Select Dynamic Form select
Dynamic Color Dynamic Color
Dynamic Color Calendar
Textbox Counter Textbox Counter
Alphanumeric Alphanumeric
Date Time Script Date & Time
Stop Watch Script Stop Watch script
Delete Repeated Values Delete Repeated Values
Pagination Pagination
Random Generator Random Generator
Animated Text Animated Text
Cursor Position Cursor Position
User Info Window / User Info
Security Security / Authenticate
Bookmark Bookmark
Mouse Effects Mouse Effects
Title Bar Title Bar
Status Bar Status Bar
Country List Country List
Free Games Free Games
Calculators Calculators
 

Javascript Square root Calculator


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


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

Preview

Square root-Calculator

Enter a Number :

 
The SqureRoot :
©hscripts.com


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>
&copy;<a href="http://hscripts.com">hscripts.com</a>
</form>

Release Date - 07-04-2008
Get free version without ©copyright link for just 5 price

For customization of this script or any script development, contact us at support@hscripts.com


Usage
Here we have explained with a form
a)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>
   &copy;<a href="http://hscripts.com">hscripts.com</a>
    </form>

b)The javascript function sqr() is triggered, when the button is clicked.
c)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 the codes as it is.
- Free, if your modification does not remove our copyright information and links.
- Click Here for detailed license information.
- You can purchase the script if your requirements does not meet our GPL License terms.
Other Links

web hosting