当前位置:网站首页>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生成验证码图片,并进行验证, 更多内容欢迎关注之后的文章
边栏推荐
猜你喜欢
随机推荐
LeetCode 2360. 图中的最长环 基环树找环+时间戳
I interviewed a 985 graduate, and I will never forget the expression when answering the "performance tuning" question
牛客刷题:手动实现数组filter方法
Swin Transformer 论文精读,并解析其模型结构
golang 刷leetcode:将字符串翻转到单调递增
Flink优化的方方面面
2022-08-02 第六小组 瞒春 学习笔记
主成分分析(PCA)
JumpServer open source bastion machine completes Loongson architecture compatibility certification
Zabbix 5.0 监控教程(二)
go exec 包
命令行启动常见问题及解决方案
【C语言进阶】--指针典题剖析
H.265视频流媒体播放器EasyPlayer.js集成时出现“SourceBuffer ”报错,该如何解决?
你我都会遇到的需求:如何导出MySQL中的数据~ 简单!实用!
win10安全中心设置不扫描某个文件夹的方法
golang刷leetcode:统计区间中的整数数目
手把手教你干掉if else
matplotlib绘图的核心原理讲解(超详细)
golang 刷leetcode:统计打字方案数









