Skip to main content

29/4/2021 JAVASCRIPT



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

<body>
<script type="text/javascript">
// Chu thich cho 1 dong
/* cho nhieu dong*/

document.write("<p align='center'>Hello <b>abc</b></p>");
document.write("Hello xyz");
document.write("<table border='1' width='500'>");
document.write("<tr><td>Ten</td><td>Tuoi</td></tr>");
document.write("<tr><td>Ti</td><td>17</td></tr>");
document.write("</table>");

//Bien:
a=5;
var d;
b=7;
c="hello";
document.write("Gia tri cua bien c la:");
document.write(c);
//Phep noi chuoi: +
document.write("<br/>Gia tri cua bien a la:<b>"+a+"</b>");
d=a+b;
document.write("<br/>Gia tri cua bien d:"+d);
//Cac phep toan: +,-,*,/,%,^

//Mot so hop thoai:

//Hop thoai thong bao: su dung ham alert()
//alert("Hello xyz");


//Hop thoai nhap lieu: cho phep nhap du lieu tu ban phim, su dung ham prompt():
/*kq=prompt("Nhap gi do:","");
document.write(kq+a);*/
//tam=parseInt("0123"); sau khi thuc hien tam chua so 123
//parseFloat()
/*d="hello 123";
document.write("gia tri moi cua bien d la:"+d);*/

//document.write("Ban vua nhap:"+prompt("Nhap gia tri moi:",""))

//Hoi thoai xac nhan: su dung ham confirm():
/*tl=confirm("Ban co muon nghi khong?");
document.write("<br/>Ban vua chon:"+tl);
*/

//Cac phep so sanh: >, <, >=, <=, ==, != (khac)
//Cac phep logic: && (and), || (or), ! (not)
//0 tuong duong false; khac 0 tuong duong true


//Cac cau lenh cau truc co ban: if...else, switch...case, for, while, do...while...

//Cau truc if...else: cau truc dieu kien, cau truc re nhanh
/*if(dieu_kien)
lenh_p;
else
lenh_q;


lenh_p, lenh_q: cau lenh don, cau lenh cau truc khac, khoi lenh: { cac lenh } */
/*if(a>b)
{
document.write("Hello abc!");
document.write("Gia tri cua a la:"+a);
}
else
{
document.write("Hello 123!");
document.write("Gia tri cua b la:"+b);
}*/

/*if(dieu_kien)
lenh_p;*/
if(a>b)
{
document.write("Hello abc!");
}




document.write("<br/>Ket thuc trang!");
</script>
</body>
</html>

Javascript

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