| <!doctype html> | |
| <html> | |
| <head> | |
| <meta charset="utf-8"> | |
| <title>Untitled Document</title> | |
| </head> | |
| <body> | |
| <script type="text/javascript"> | |
| a = parseInt(prompt("Nhap vao so a: ", " ")); | |
| b = parseInt(prompt("Nhap vao so b: ", " ")); | |
| pt = prompt("Nhap vao phep tinh ma ban muon tinh ( +, -, *, /) "); | |
| tong=a+b; | |
| hieu=a-b; | |
| nhan=a*b; | |
| chia=a/b; | |
| /*//xuat ket qua | |
| if(c == "+") | |
| document.write("Ket qua " +a+ " " +pt+ " " +b+ " = " +tong); | |
| else if(c == "-") | |
| document.write("Ket qua " +a+ " " +pt+ " " +b+ " = " +hieu); | |
| else if(c == "*") | |
| document.write("Ket qua " +a+ " " +pt+ " " +b+ " = " +nhan); | |
| else | |
| document.write("Ket qua " +a+ " " +pt+ " " +b+ " = " +chia); | |
| //else if(c!="+" && c!="-" && c!="*" && c!="/"); | |
| //document.write("Ban nhap sai phep tinh roi: ");*/ | |
| switch(pt) | |
| { | |
| case "+" : document.write("Ket qua " +a+ " " +pt+ " " +b+ " = " +tong); | |
| break; | |
| case "-" : document.write("Ket qua " +a+ " " +pt+ " " +b+ " = " +hieu); | |
| break; | |
| case "*" : document.write("Ket qua " +a+ " " +pt+ " " +b+ " = " +nhan); | |
| break; | |
| case "/" : if(b==0) | |
| document.write(alert ("b phải khác không mới tính được")); | |
| else | |
| document.write("Ket qua " +a+ " " +pt+ " " +b+ " = " +chia); | |
| break; | |
| default: document.write("Ban nhap sai phep tinh."); | |
| } | |
| </script> | |
| </body> | |
| </html> | |
//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...
Comments
Post a Comment