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
Calendar Script 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
 




Quadratic Equation Calculator


About
This free javascript calculator is used for quadratic calculation based on quadratic equation. This Quadratic calculator is for free.


Features
a) Javascript Quadratic calculator calculates the roots for given co-ordinates
b) This is a free javascript calculator.
c) Just copy the code into your page and use it.

Preview

Enter values in Quadratic Equation format ,that is in ax2+bx+c=0 format

Quadratic Calculator
x2+ x+  =0

Result
Root 1: Root 2:
©hscripts.com


Code
  Javascript Code
<!--        Script by hscripts.com          -->
<!--        copyright of HIOX INDIA         -->
<!-- Free javascripts @ http://www.hscripts.com -->
<script type="text/javascript">
function quad()
{
	var a=document.getElementById("av").value;
	var b=document.getElementById("bv").value;
	var c=document.getElementById("cv").value;
	if(a!=0)
	{
		var d=(Math.pow(b,2)-(4*a*c));
		var x1=(-b + Math.sqrt(d)) / 2*a
		var x2=(-b - Math.sqrt(d)) / 2*a
		if(d>0)
		{
			document.getElementById("r1").value=x1;
			document.getElementById("r2").value=x2;
			document.getElementById("rcom").innerHTML="The Roots Are Real And Unequal"
		}
		if(d==0)
		{
			document.getElementById("r1").value=x1;
			document.getElementById("r2").value=x2;
			document.getElementById("rcom").innerHTML="The Roots Are Real And Equal"	
		}
		if(d<0)
		{
			document.getElementById("r1").value="imag";
			document.getElementById("r2").value="imag";
			document.getElementById("rcom").innerHTML="The Roots Are Imaginary"
		}
	}	
}
function keycheck(event,tx)
{
var kc;
if(window.event)
{
	kc=event.keyCode;
}
else
{
	kc=event.which;
}
var a=tx.value;
if(kc==45)
{
	if(a.length==0)
	{
		return true;
	}
	else
	{
		return false;
	}
}
if(kc==48)
{
	if(a.indexOf("-")==0 && a.length==1)
	{
		return false;
	}
	
	
	if(a=="")
	{
		return false;
	}
	else
	{
		return true;
	}
}  
if (kc!=8 && kc!=0)
{
	if (kc<49||kc>57)
	{
		return false;
	}
} 

}
</script>
<!-- Script by hscripts.com -->


HTML Code
<!--        Script by hscripts.com          -->
<!--        copyright of HIOX INDIA         -->
<!-- Free javascripts @ http://www.hscripts.com -->
<!-- Script by hscripts.com -->
<form name="qfrm">
<table>
<tr>
<td><input type="text" name="av" id="av" size="3" onkeypress="return keycheck(event,av)">x<sup>2</sup>+</td>
<td><input type="text" name="bv" id="bv" size="3" onkeypress="return keycheck(event,bv)">x+</td>
<td><input type="text" name="cv" id="cv" size="3" onkeypress="return keycheck(event,cv)"></td></tr>
<tr rowspan="2"><td colspan="3" align="center"><input type="button" value="Calculate" onclick="quad()"></td></tr>
</table>
<table>
<tr rowspan="2"><td colspan="3" align="center">Result</td></tr>
<tr><td>Root 1<input type="text" name="r1" id="r1" size="10" readonly></td>
<td>Root 2<input type="text" name="r2" id="r2" size="10" readonly></td></tr>
<tr rowspan="2"><td colspan="2" align="center"><div id="rcom"></div></td></tr>
</table>
</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
Just follow the below instructions to have your own Quadratic Calculator

a) Copy the HTML code given above,save it with .html extension.
b) Just copy and paste the javascript code given above in <head> section of HTML file.
c) Run the file in any web browser, to have your own Quadratic calculator.



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