// document.querySelector() is used to select an element from the document using its ID let captchaText = document.querySelector('#captcha'); var ctx = captchaText.getContext("2d"); ctx.font = "30px Roboto"; ctx.fillStyle = "#08e5ff"; let userText = document.querySelector('#textBox'); let submitButton = document.querySelector('#submitButton'); let output = document.querySelector('#output'); let refreshButton = document.querySelector('#refreshButton'); // alphaNums contains the characters with which you want to create the CAPTCHA let alphaNums = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9']; let emptyArr = []; // This loop generates a random string of 7 characters using alphaNums // Further this string is displayed as a CAPTCHA for (let i = 1; i <= 7; i++) { emptyArr.push(alphaNums[Math.floor(Math.random() * alphaNums.length)]); } var c = emptyArr.join(''); ctx.fillText(emptyArr.join(''),captchaText.width/4, captchaText.height/2); // This event listener is stimulated whenever the user press the "Enter" button // "Correct!" or "Incorrect, please try again" message is // displayed after validating the input text with CAPTCHA userText.addEventListener('keyup', function(e) { // Key Code Value of "Enter" Button is 13 if (e.keyCode === 13) { if (userText.value === c) { output.classList.add("correctCaptcha"); output.innerHTML = "Correct!"; } else { output.classList.add("incorrectCaptcha"); output.innerHTML = "Incorrect, please try again"; } } }); // This event listener is stimulated whenever the user clicks the "Submit" button // "Correct!" or "Incorrect, please try again" message is // displayed after validating the input text with CAPTCHA submitButton.addEventListener('click', function() { if (userText.value === c) { output.classList.add("correctCaptcha"); output.innerHTML = "Correct!"; } else { output.classList.add("incorrectCaptcha"); output.innerHTML = "Incorrect, please try again"; } }); // This event listener is stimulated whenever the user press the "Refresh" button // A new random CAPTCHA is generated and displayed after the user clicks the "Refresh" button refreshButton.addEventListener('click', function() { userText.value = ""; let refreshArr = []; for (let j = 1; j <= 7; j++) { refreshArr.push(alphaNums[Math.floor(Math.random() * alphaNums.length)]); } ctx.clearRect(0, 0, captchaText.width, captchaText.height); c = refreshArr.join(''); ctx.fillText(refreshArr.join(''),captchaText.width/4, captchaText.height/2); output.innerHTML = ""; });

Giá: 000.000đ

khi mua 2 chiếc

  • MIỄN PHÍ ship trên toàn quốc
  • KIỂM HÀNG trước khi thanh toán
  • BẢO HÀNH sản phẩm trong 6 thán

MUA HÀNG NGAY

Được đổi trả trong vòng 7 ngày

MUA HÀNG NGAY

Coupon $5
Samsung Galaxy Z Fold4
Coupon $50
Coupon $20
Coupon $10
Iphone 14 Pro Max

MUA HÀNG NGAY

Khuyến mãi sắp kết thúc

00
00
00
00

Để lại thông tin và shop sẽ tư vấn

MUA HÀNG NGAY

sản phẩm cuối cùng
Sắp hết hàng! chỉ còn

98

người đang xem sản phẩm này
Đang có

233

Nhanh tay lên
Sau khi nhận được thông tin đặt hàng
chúng tôi sẽ liên hệ ngay với quý khách
  • Màu sắc: Xanh dương, Cam, Nâu Đất, Xanh Thông
  • Phù hợp với nhiều hoàn cảnh sử dụng: Đi làm, dự tiệc, vui chơi dã ngoại
  • Chất vải chống nhăn, thấm hút mồ hôi
  • Phong cách thời trang phù hợp cho mùa hè
  • Size: M-L-XL-2XL
  • Phân loại: Áo thun nam cao cấp
COUPON 5%
COUPON 30%
COUPON 10%
THÊM LƯỢT
COUPON 15%
COUPON 20%
Lorem ipsum dolor sit amet,

CALL TO ACTION

Spin the wheel and win

Portenta haec esse dicit, neque ea ratione ullo