当前位置:网站首页>Broadcast platform, the use of the node generated captcha image, and validate
Broadcast platform, the use of the node generated captcha image, and validate
2022-08-03 00:37:00 【Cloud Leopard Network Technology】
搭建直播平台,使用node生成验证码图片,并进行验证
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js">
<title>验证码测试</title>
</head>
<body>
<div id="box"></div>
<button id="btn">刷新</button>
<input type="text" id="ipt" />
<span id="span"></span>
<script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js"></script>
<script>
const box = document.querySelector('#box')
const btn = document.querySelector('#btn')
const ipt = document.querySelector('#ipt')
const span = document.querySelector('#span')
// 存放正确的验证码文本
let text = ''
// 获取验证码图片和文本
function getInfo() {
$.get('http://127.0.0.1/getInfo', (res) => {
// 正确验证码的信息
text = res.text
// res.data是一个验证码图片 svg标签
box.innerHTML = res.data
console.log(text)
})
}
getInfo()
btn.addEventListener('click', getInfo)
ipt.addEventListener('blur', function (e) {
if (this.value.toLowerCase() === text.toLowerCase()) {
span.innerHTML = '验证通过'
span.style.color = 'green'
} else {
span.innerHTML = '验证不通过'
span.style.color = 'red'
}
})
</script>
</body>
</html>
That is broadcast platform,使用node生成验证码图片,并进行验证, 更多内容欢迎关注之后的文章
边栏推荐
猜你喜欢

Auto.js脚本程序打包

你我都会遇到的需求:如何导出MySQL中的数据~ 简单!实用!

Do you understand the factory pattern?

总结嵌入式C语言难点(2部分)

【TypeScript】深入学习TypeScript类(下)

What is the core business model of the "advertising e-commerce" that has recently become popular in the circle of friends, and is the advertising revenue really reliable?

Interviewer: can you talk about optimistic locking and pessimistic locks

网络运维系列:健康检查的方式

搭建Spark开发环境(第二弹)

双轴晶体中锥形折射的建模与应用
随机推荐
牛客刷题:手动实现数组filter方法
【c】操作符详解(一)
软件测试笔试题1(附答案)
UDP(用户数据报协议)
搭建直播平台,使用node生成验证码图片,并进行验证
Teach you how to kill if else
Add and delete all these years, finally planted in MySQL architecture design!
# 医院管理系统完整项目代码以及数据库建表语句分享
word操作:单独调整英文字体
How to seize the new trend of NFT, yuan|universe|universe?
matplotlib绘图的核心原理讲解(超详细)
golang 刷leetcode:统计打字方案数
SSM integration steps (emphasis)
UDP (User Datagram Protocol)
js函数防抖和函数节流及其他使用场景
牛客每日刷题之链表
行业 SaaS 微服务稳定性保障实战
Jmeter二次开发实现rsa加密
四、字符常量 & 字符串
kubernetes pod podsecurityPolicies(PSP)