By GokiSoft.com| 15:13 15/12/2020|
Học JS

[Share Code] Chia sẻ code tìm hiểu JS - Biến, toán tử, mệnh đề điều kiên - Lập trình JS

#test.html


<!DOCTYPE html>
<html>
<head>
	<title>Javascript tutorial</title>
	<meta charset="utf-8">
</head>
<body>
	<h1 style="text-align: center;">Welcome to learn Javascript</h1>

	<script type="text/javascript">
		//noi thuc hien code JS
		document.write('Hello World!!!');
		console.log('testing...');
		//Khai bao bien
		x = 5;//hieu la bien so nguyen
		var y = 6;//hieu la y la so nguyen
		x = "Sinh vien aptech" //hieu x la string (chuoi)
		console.log(x)
		//Toan tu +, -, *, /, %, ++, -- => su dung giong C
		x = 5
		x = x + y //x = 11
		console.log(x)

		t1 = "12"
		t2 = 2
		t3 = t1 + t2
		//mong muon ket qua = 14
		t3 = parseInt(t1) + parseInt(t2)
		console.log(t3)
		t3 = t1 * t2
		console.log(t3)

		// alert('Ban co muon mat tai khoan khong???')
		// var option = confirm('Ban co muon xoa tai khoan nay khong???')
		// console.log(option)
		// var x = prompt('Nhap gia tri x')
		// console.log(x)
		x = 5
		y = ++x
		console.log(x + ", " + y)

		//t = 6 (x=7) + 8 (x=8) - 5(y=5) + 1 = 10
		t = x++ + ++x - --y + 1
		console.log(x + ", " + y + ", " + t)

		k = (t==10)?'Hello B':'Bye' //bieu thuc dieu kien
		console.log(k)

		var quantity = prompt('Nhap vao quantity: ', 0)

		if(quantity < 0 || isNaN(quantity)) {
			alert('Nhap gia tri la so nguyen duong')
		}

		//Khai bao mang trong JS
		
	</script>
</body>
</html>


#vidu.html


<!DOCTYPE html>
<html>
<head>
	<title>Javascript tutorial</title>
	<meta charset="utf-8">

	<style type="text/css">
		body {
			background-color: black;
		}
	</style>
</head>
<body>
	<table border="1" cellpadding="3" cellspacing="3">
		<tr>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
		</tr>
		<tr>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
		</tr>
		<tr>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
		</tr>
		<tr>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
		</tr>
		<tr>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
		</tr>
		<tr>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
		</tr>
		<tr>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
		</tr>
		<tr>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
		</tr>
		<tr>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
		</tr>
		<tr>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
		</tr>
		<tr>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
		</tr>
		<tr>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
		</tr>
		<tr>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
		</tr>
		<tr>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
		</tr>
		<tr>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
			<td style="width: 50px; background-color: red; height: 50px;"></td>
		</tr>
	</table>

	<script type="text/javascript">
		function playLeds() {
			var tdList = document.getElementsByTagName('td')
			for (var i = tdList.length - 1; i >= 0; i--) {
				var c1 = Math.floor(Math.random() * 255);
				var c2 = Math.floor(Math.random() * 255);
				var c3 = Math.floor(Math.random() * 255);

				tdList[i].style.backgroundColor = `rgb(${c1}, ${c2}, ${c3})`
			}
		}

		setInterval(function() {
			playLeds()
		}, 100)
	</script>
</body>
</html>


Tags:

Phản hồi từ học viên

5

(Dựa trên đánh giá ngày hôm nay)