mertcek123
Programmer
Hello my friends,
Im trying to learn javascript I wrote this code, this is my first trial. But it doesnt work can you help me to solve the problem. I think you will understand it what does it work for.. like in highschool it finds the value of discriminant and says whether the roots are real or not.
this my code
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "<html xmlns="<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script type="Javascript">
function delta ()
{ var a = first.A.value;
var b = second.B.value;
var c = third.C.value;
var delta = (b*b) - (4*a*c);
if (delta<0)
{
alert("Equation has no real roots");
}
else if (delta=0)
{
alert("Equation has 2 real equal roots");
}
else if (delta >0)
{
alert("Equation has 2 different real roots");
}
}
</script>
</head>
<body>
<FORM NAME="first">
A'yi yaziniz: <INPUT TYPE="text" NAME=A SIZE=5>
</INPUT>
<FORM NAME="second">
B'yi yaziniz: <INPUT TYPE="text" NAME=B SIZE=5>
</INPUT>
<FORM NAME="third">
C'yi yaziniz: <INPUT TYPE="text" NAME=C SIZE=5>
</INPUT>
<input name="execute" type="button" value="Diskriminant'i gor" onclick="delta()" />
</body>
</html>
please help me to improve myself.
Im trying to learn javascript I wrote this code, this is my first trial. But it doesnt work can you help me to solve the problem. I think you will understand it what does it work for.. like in highschool it finds the value of discriminant and says whether the roots are real or not.
this my code
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "<html xmlns="<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script type="Javascript">
function delta ()
{ var a = first.A.value;
var b = second.B.value;
var c = third.C.value;
var delta = (b*b) - (4*a*c);
if (delta<0)
{
alert("Equation has no real roots");
}
else if (delta=0)
{
alert("Equation has 2 real equal roots");
}
else if (delta >0)
{
alert("Equation has 2 different real roots");
}
}
</script>
</head>
<body>
<FORM NAME="first">
A'yi yaziniz: <INPUT TYPE="text" NAME=A SIZE=5>
</INPUT>
<FORM NAME="second">
B'yi yaziniz: <INPUT TYPE="text" NAME=B SIZE=5>
</INPUT>
<FORM NAME="third">
C'yi yaziniz: <INPUT TYPE="text" NAME=C SIZE=5>
</INPUT>
<input name="execute" type="button" value="Diskriminant'i gor" onclick="delta()" />
</body>
</html>
please help me to improve myself.