当前位置:网站首页>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生成验证码图片,并进行验证, 更多内容欢迎关注之后的文章
边栏推荐
猜你喜欢
If the watermark according to how to realize the function
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?
Jmeter二次开发实现rsa加密
[C题目]力扣138. 复制带随机指针的链表
如何抓住NFT、元|宇|宙新趋势?
Word operation: adjust the English font individually
Win10怎么开启自带的游戏录屏功能?
采用QT进行OpenGL开发(三)着色器编程
行业 SaaS 微服务稳定性保障实战
30天啃透这份Framework 源码手册直接面进大厂
随机推荐
The only way to go from a monthly salary of 10k to 30k: automated testing
Command line startup FAQs and solutions
YAML文件格式
golang刷leetcode:巫师的总力量和
采用QT进行OpenGL开发(三)着色器编程
JumpServer开源堡垒机完成龙芯架构兼容性认证
LeetCode 2360. 图中的最长环 基环树找环+时间戳
Zabbix 5.0 监控教程(二)
宝塔搭建实测-基于ThinkPHP5.1的wms进销存源码
golang 刷leetcode:将字符串翻转到单调递增
golang 刷leetcode:从栈中取出 K 个硬币的最大面值和
网络运维系列:健康检查的方式
H.265视频流媒体播放器EasyPlayer.js集成时出现“SourceBuffer ”报错,该如何解决?
测试ESP32-Zigbee转发命令 : 滑轨、继电器控制
golang刷letcode:公平分发饼干
If the watermark according to how to realize the function
group of people
2022-08-02 第六小组 瞒春 学习笔记
go rand 包
【TypeScript】深入学习TypeScript类(上)