当前位置:网站首页>搭建直播平台,使用node生成验证码图片,并进行验证
搭建直播平台,使用node生成验证码图片,并进行验证
2022-08-02 21:23:00 【云豹网络科技】
搭建直播平台,使用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>
以上就是搭建直播平台,使用node生成验证码图片,并进行验证, 更多内容欢迎关注之后的文章
边栏推荐
- 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?
- 面试了个985毕业的,回答“性能调优”题时表情令我毕生难忘
- FRED应用:激光二极管光源耦合到光纤的仿真
- 测试ESP32-Zigbee转发命令 : 滑轨、继电器控制
- golang刷leetcode:我能赢吗
- golang刷letcode:公平分发饼干
- wallys/new product/WiFi6 MiniPCIe Module 2T2R 2×2.4GHz 2x5GHz MT7915 MT7975
- JumpServer开源堡垒机完成龙芯架构兼容性认证
- 解道9-编程技术6
- Intensive reading of the Swin Transformer paper and analysis of its model structure
猜你喜欢
你我都会遇到的需求:如何导出MySQL中的数据~ 简单!实用!
Byte's internal technical map is amazing and practical
IP协议(网际协议)
Bee 事务注解 @Tran 使用实例
面试官:可以谈谈乐观锁和悲观锁吗
sre成长之路
【STM32学习2】存储器相关概念与操作
总结嵌入式C语言难点(2部分)
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?
ML之PDP:基于titanic泰坦尼克是否获救二分类预测数据集利用PDP部分依赖图对RF随机森林和LightGBM模型实现可解释性案例
随机推荐
UDP(用户数据报协议)
golang刷leetcode:按位与结果大于零的最长组合
无线振弦采集仪远程修改参数的方式
JS函数防抖&函数节流及其使用场景
字节内部技术图谱 惊艳级实用
行业 SaaS 微服务稳定性保障实战
Flink优化及相关
ORB SLAM3加载Vocabulary更快ORBvoc.bin
【DEBUG】ImportError: Unable to import required dependencies: numpy: DLL load failed: 找不到指定的模块。
解道8-编程技术5
js how to get the browser zoom ratio
[Dry goods] Best practice of sub-library and sub-table
js函数防抖和函数节流及其他使用场景
Sentinel vs Hystrix 限流对比,到底怎么选?
[C题目]力扣1. 两数之和
汉源高科2光12电千兆导轨式网管型工业以太网交换机双光自愈保护式以太网光交换机
Flink Yarn Per Job - 启动AM
最近火爆朋友圈的“广告电商”,核心商业模式是什么,广告收入真实靠谱吗?
Jar包启动通过ClassPathResource获取不到文件路径问题
Interviewer: can you talk about optimistic locking and pessimistic locks