Skip to main content

Posts

Showing posts from May 6, 2021

(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>

(JAVASCRIPT) Tạo 1 bảng gồm n dòng n cột do người nhập // Vòng lặp for

Untitled Document //Tạo 1 bảng gồm n dòng n cột do người nhập // Vòng lặp for <!doctype html> <html> <head> <meta charset="utf-8"> <title>Untitled Document</title> </head> <body> <script type="text/x-javascript">     //Tạo 1 bảng gồm n dòng n cột do người nhập m=parseInt(prompt("Nhập số dòng: ","")); n=parseInt(prompt("Nhập số cột: ","")); document.write("<table border='1' width=60%>") for(i=1;i<=m;i++) { document.write("<tr>&nbsp;</tr>") for(j=1;j<=n;j++) document.write("<td>&nbsp;</td>") } document.write("</table>")     </script> </body> </html>

(JAVASCRIPT) in các bảng cửu chương từ 2 -> 9 trong các cột // Vòng lặp for

Untitled Document //in các bảng cửu chương từ 2 -> 9 trong các cột // Vòng lặp for <!doctype html> <html> <head> <meta charset="utf-8"> <title>Untitled Document</title> </head> <body>     <script type="text/x-javascript"> //in các bảng cửu chương từ 2 -> 9 trong các cột     document.write("<table border='1' width=60%><tr>") for(i=2;i<=9;i++) { document.write("<td>") for(j=1;j<=10;j++) document.write(i+" X "+j+" = "+(i*j)+"<br/>") document.write("</td>") } document.write("</tr></table>")     </script> </body> </html>

(JAVASCRIPT) NHẬP VÀO 1 SỐ NGUYÊN N, in ra 1 bảng gồm 1 dòng và n cột // for(i=1;i<=n;i++)

Untitled Document //NHẬP VÀO 1 SỐ NGUYÊN N, in ra 1 bảng gồm 1 dòng và n cột //NHẬP VÀO 1 SỐ NGUYÊN N, in ra 1 bảng gồm 1 dòng và n cột <!doctype html> <html> <head> <meta charset="utf-8"> <title>Untitled Document</title> </head> <body> //NHẬP VÀO 1 SỐ NGUYÊN N, in ra 1 bảng gồm 1 dòng và n cột     <script type="text/javascript">     n=parseInt(prompt("Nhập số bất kỳ: ","")); document.write("<table border='1' width='60%'><tr>"); for(i=1;i<=n;i++) document.write("<td>&nbsp;</td>"); document.write("</tr></table>");     </script> </body> </html>

(JAVASCRIPT) Vòng lặp for - Bảng cửu chương // for(i=1;i<=10;i++)

Untitled Document //Vòng lặp for - Bảng cửu chương   <!doctype html> <html> <head> <meta charset="utf-8"> <title>Untitled Document</title> </head> <body> <script type="text/javascript"> n=parseInt(prompt("Nhập vảo số: ","")); for(i=1;i<=10;i++) { ketqua = n * i; document.write(+n+" X "+i+" = "+ketqua); document.write("<br/>"); }        </script> </body> </html>

(TÀI LIỆU) Web tĩnh PHP

Untitled Document