Skip to main content

(JAVASCRIPT) Tạo 1 bảng 10 dòng 5 cột // Vòng lặp for

Untitled Document //Tạo 1 bảng 10 dòng 5 cột // Vòng lặp for
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Untitled Document</title>
</head>

<body>
<script type="text/javascript">
    document.write("<table border='1' width=80%>");
for(i=1;i<=10;i++)
{
switch(i)
{
case 1: case 3: color='yellow';break;
case 2: case 7: color='green';break;
case 4: case 9: color='red';break;
default: color='blue';
}
document.write("<tr bgcolor="+color+">")
for(j=1;j<=5;j++)
document.write("<td>2</td>");
document.write("</tr>")
}
document.write("</table>");
//1,3:vàng 2,7:xanh lá 4,9:đỏ còn lại:xanh dương
    </script>
</body>
</html>

Comments

Popular posts from this blog

PHP#33MySQL#29 - Đếm lượt truy cập (KẾT THÚC KHÓA HỌC)

//hitcounter.php <?php session_start();  ?> <!doctype html> <html> <head> <meta charset="utf-8"> <title>Untitled Document</title> </head> <body> <?php  include("../connect.php"); //cập nhật số luowhtj truy cập: $sl="update counter set cnt=cnt+1"; mysqli_query($link,$sl); //Lấy dữ liệu số lượt truy cập để hiển thị ra web: $sl2="select * from counter"; $kq=mysqli_query($link,$sl2); $d=mysqli_fetch_array($kq); //Định dạng: $chuoi=str_pad($d['cnt'],6,"0",STR_PAD_LEFT); $luottrycap=""; for($i=0;$i<strlen($chuoi);$i++) { $tam=substr($chuoi,$i,1); $luottrycap.="<img src='images/$tam.png'/>"; } /*-Khi user truy cập vào website: +lần đầu tuy cập: Lưu thông tin của user lên csdl +Sau lần đầu tiên: cập nhtaaj lastvisit - Xóa các dòng dữ liệu quá 1 phút (Quy ước thời gian để khẳng định online hay offline: 1 phút) - Thống kê số liệu người dùng o...

2 (giao diện Visual C#) Solution Explorer

Bài 2 - SOME OTHER TIME - Vào dịp khác