chihong
22-01-2009, 05:03 PM
MÃ HTML thay thế
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
</head>
<script type="text/javascript">
function giaift(f)
{
var a= f.a.value;
var b= f.b.value;
var c= f.c.value;
var x1,x2,denta,can ;
with (Math)
{
denta= b*b- 4*a*c;
can= sqrt(denta);
}
if ( a== 0)
{
if ( b == 0 )
x1 = x2 = "vo nghiem";
else
x1 = -c/b;
}
else
{
if ( denta > 0)
{
x1= eval(-b + can)/ eval(2*a);
x2= eval(-b - can)/ eval(2*a);
}
else if ( denta == 0 )
x1 = x2 = eval(-b )/ eval(2*a);
else
x1 = x2 ="vo nghiem";
}
f.n1.value = x1;
f.n2.value = x2;
}
</script>
<body>
<form>
<table width="300" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>Nhap a:</td>
<td><input type="text" value="" name="a"></td>
</tr>
<tr>
<td>Nhap b:</td>
<td><input type="text" value="" name="b"></td>
</tr>
<tr>
<td>Nhap c:</td>
<td><input type="text" value="" name="c"></td>
</tr>
<tr>
<td colspan="2"><input type="button" value="Giai phuong trinh" name="nghiem" onClick="giaift(this.form)"></td>
</tr>
<tr>
<td>nghiem 1:</td>
<td><input type="text" value="" name="n1"></td>
</tr>
<tr>
<td>nghiem 2:</td>
<td><input type="text" value="" name="n2"></td>
</tr>
</table>
</form>
</body>
</html>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
</head>
<script type="text/javascript">
function giaift(f)
{
var a= f.a.value;
var b= f.b.value;
var c= f.c.value;
var x1,x2,denta,can ;
with (Math)
{
denta= b*b- 4*a*c;
can= sqrt(denta);
}
if ( a== 0)
{
if ( b == 0 )
x1 = x2 = "vo nghiem";
else
x1 = -c/b;
}
else
{
if ( denta > 0)
{
x1= eval(-b + can)/ eval(2*a);
x2= eval(-b - can)/ eval(2*a);
}
else if ( denta == 0 )
x1 = x2 = eval(-b )/ eval(2*a);
else
x1 = x2 ="vo nghiem";
}
f.n1.value = x1;
f.n2.value = x2;
}
</script>
<body>
<form>
<table width="300" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>Nhap a:</td>
<td><input type="text" value="" name="a"></td>
</tr>
<tr>
<td>Nhap b:</td>
<td><input type="text" value="" name="b"></td>
</tr>
<tr>
<td>Nhap c:</td>
<td><input type="text" value="" name="c"></td>
</tr>
<tr>
<td colspan="2"><input type="button" value="Giai phuong trinh" name="nghiem" onClick="giaift(this.form)"></td>
</tr>
<tr>
<td>nghiem 1:</td>
<td><input type="text" value="" name="n1"></td>
</tr>
<tr>
<td>nghiem 2:</td>
<td><input type="text" value="" name="n2"></td>
</tr>
</table>
</form>
</body>
</html>