TKW8
BT1
<html>
<head>
<title>BT1</title>
<script>
var hoten,lop;
hoten=prompt("Hãy nhập tên của bạn");
lop=prompt("Hãy nhập lớp của bạn");
document.write(hoten + "<br>" + "<center>");
document.write(lop + "<center>");
</script>
</head>
<body>
</body>
</html>
BT2
<html>
<head>
<title>BT2</title>
<script>
var ht;
var lop;
function tb()
{
ht = document.TTS.hoten.value;
lop = document.TTS.lop.value;
alert("Họ tên: " + ht + "\n" + "Lớp: " + lop);
}
</script>
</head>
<body>
<form name="TTS">
<input type="text" name="hoten"><br>
<input type="text" name="lop"><br>
<input type="button" onClick= "tb();" value="Thực hiện">
</form>
</body>
</html>
BT3
<html>
<head>
<title>BT2</title>
<script>
var ht;
var lop;
var phai;
function tb()
{
ht = document.dtt.hoten.value;
lop = document.dtt.lop.value;
if (document.dtt.phaiNam.checked)
phai = "Nam";
if (document.dtt.phaiNu.checked)
phai = "Nữ";
alert("Họ tên: " + ht + "\n" + "Lớp: " + lop + "\n" + "Phái: " + phai);
}
</script>
</head>
<body>
<table width="300" height="100">
<form name = "dtt">
<table width="240" border="1">
<tr>
<td width="55">Họ tên</td>
<td width="169"><input type="text" name="hoten"></td>
</tr>
<tr>
<td>Lớp</td>
<td><input type="text" name="lop"></td>
</tr>
<tr>
<td>Phái</td>
<td>Nam
<input type="radio" name="phaiNam" value="Nam">
Nữ;
<input type="radio" name="phaiNu" value="Nữ"></td>
</tr>
<tr>
<td colspan="2" align="center"><input name="button" type="button" onClick= "tb();" value="Thực hiện"><input type="button" value="Reset"></td>
</tr>
</form>
</table>
</body>
</html>
BT4
<html>
<head>
<title>MMQ TN11TH</title>
<script>
var hoamai = "file:///Y:/TN11TH/TKWeb/hoamai.png";
var hoasen = "file:///Y:/TN11TH/TKWeb/hoasen.png";
function check(flag)
{
switch(flag)
{
case 1:
document.picBox.src = hoamai;
break;
case 2:
document.picBox.src = hoasen;
break;
}
}
</script>
</head>
<body>
<img src="file:///Y:/TN11TH/TKWeb/hoasen.png" width="100" height="100" onMouseOver="check(1);" onMouseOut="check(2);" name="picBox">
</body>
</html>
BT5
<html>
<head>
<title>Untitled Document</title>
<script>
var a, c, b;
var delta, cdelta;
var x1, x2;
var kq;
var ngiem;
function clickEvent()
{
a = parseInt(document.MMQ.tF_a.value);
b = parseInt(document.MMQ.tF_b.value);
c = parseInt(document.MMQ.tF_c.value);
delta = b*b - 4 * a * c;
if (delta == 0)
{
alert("Phương trình có nghiệm kép.");
x1 = -b/(2*a);
x2 = -b/(2*a);
// In ra man hinh ket qua.
alert("x1: " + x1 + "\n" + "x2: " + x2);
}
else if (delta < 0)
{
alert("Phương trình vô nghiệm.");
}
else if (delta > 0)
{
alert("Phương trình có hai nghiệm phân biệt.");
x1 = -b + Math.sqrt(delta)/(2*a);
x2 = -b - Math.sqrt(delta)/(2*a);
// In ra man hinh ket qua.
alert("x1: " + Math.round(x1) + "\n" + "x2: " + Math.round(x2));
}
}
</script>
</head>
<body>
<form name="MMQ">
Nhập a:
<input type="text" name="tF_a"><br>
Nhập b:
<input type="text" name="tF_b"><br>
Nhập c:
<input type="text" name="tF_c"><br>
<input type="button" name="bt" value="Tính" onClick="clickEvent();">
</form>
</body>
</html>
Không có nhận xét nào:
Đăng nhận xét