当前位置:网站首页>Can you make a JS to get the verification code?
Can you make a JS to get the verification code?
2022-07-26 05:47:00 【Mark community】
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title> Verification Code </title>
<style>
.get{
cursor: pointer;
}
.reset{
display: none;
}
.reset span{
color:red;
}
</style>
</head>
<body>
<input type="text"><button> determine </button>
<p class="get"> Get verification code </p>
<p class="reset"> Reacquire the captcha <span>10</span>s</p>
</body>
<script>function $(el) {
return document.querySelector(el);
}
let val="";
let timer=null;
function stop() {
clearInterval(timer);
timer=null;
}
$(".get").onclick=function(){
this.style.display="none";
$(".reset").style.display="block";
var chars = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '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'];
function generateMixed(n) {
var res = "";
for(var i = 0; i < n; i++) {
var id=Math.ceil(Math.random() * 35);
res +=chars[id];
}
return res;
}
var num1=generateMixed(4);
val=num1;
alert(num1);
var i=10;
timer=setInterval(() => {
i--;
$(".reset span").innerText=i;
if(i===0){
stop();
$(".reset").style.display="none";
$(".get").style.display="block";
}
}, 1000);For more information, please refer to the original , Reproduced from :https://blog.csdn.net/weixin_44519496/article/details/120074372
边栏推荐
- DOM operation -- operation node
- Properties of binary tree~
- 金仓数据库 KingbaseES SQL 语言参考手册 (7. 条件表达式)
- [paper notes] anti packet loss joint coding for network speech steganography
- idea yml 文件代码不提示解决方案
- 10. Regular expression matching
- FTP experiment and overview
- Redis persistence RDB
- [cloud native] record of feign custom configuration of microservices
- Interview questions for software testing is a collection of interview questions for senior test engineers, which is exclusive to the whole network
猜你喜欢

Another open source artifact, worth collecting and learning!

Introduction to Chinese text error correction task

高分子物理试题库

Redis publish subscription

Redis persistence AOF

The refurbishment and counterfeiting of chips have made people feel numb

Redis persistence RDB

ES Cluster in Red status: what about write & delete operations?

ES Cluster in Red status: what about write & delete operations?

Three implementation methods of thread and the usage of handler
随机推荐
520送什么?DIY一个高颜值RGB时钟,女生看了都想要
vagrant下载速度慢的解决方法
我又发现了超赞的软硬件项目,全部开源
High frequency electronic circuit review examination questions and answers
Benji Banas launched the second season of earn while playing bonus activities, supporting the use of multiple Benji passes!
Knowledge points of Polymer Physics
Two auxiliary functions of integral Mall for business user operation
为什么LPDDR不能完全代替DDR?
Motor control column summary
Application and value of IVR in VoIP telephone system
Attack and defense world flatscience
Polymer physics test question bank
Redis持久化-RDB
秋招-准备计划
Redis 官方可视化工具,高颜值,功能真心强大!
高手是怎样炼成的?
Using easyexcel to import tables to realize batch insertion of xlsx files ----- MySQL of Linux
Unity Profiler
Mba-day28 concept of number - exercise questions
金仓数据库 KingbaseES SQL 语言参考手册 (8. 函数(十))