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
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 -->
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.