当前位置:网站首页>点击产生4位随机数,验证码设置
点击产生4位随机数,验证码设置
2022-06-12 11:59:00 【mustang(野马)】
点击产生四位随机数字母与数字
<!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>点击产生随机数</title>
<style>
span{
display: block;
width: 110px;
height: 50px;
border: 1px solid red;
text-align: center;
line-height: 50px;
}
</style>
</head>
<body>
<span id="demo" onclick="init();"></span>
<script>
init();
function init(){
var arr=[];
for(var i=48;i<123;i++){
if(i>57 && i<65) continue;
if(i>90 && i<97) continue;
arr.push(String.fromCharCode(i));
}
arr.sort(function () {
return Math.random()-0.5;
});
arr.length=4;
var span= document.getElementById('demo');
span.textContent=(arr.join(""));
}
</script>
</body>
</html>
边栏推荐
- A.前缀极差
- ARM指令集之批量Load/Store指令
- FPGA Development - Hello_ World routine
- ARM处理器模式与寄存器
- ARM指令集之乘法指令
- Neighbor item status update of neighbor subsystem
- System. IO. Fileloadexception exception
- How to determine the relationship between home page and search? Relationship between homepage and search
- B. Wall painting (C language)
- 7-5 complex quaternion operation
猜你喜欢
随机推荐
影响店铺权重的三十一条,快来看看中招了吗
ARM指令集之Load/Store访存指令(二)
ARM处理器模式与寄存器
Chaîne la plus longue sans caractères dupliqués (leetcode 3)
UML series articles (31) architecture modeling - deployment diagram
TinyMCE series (I) TinyMCE environment construction
Face recognition PIP failed to install Dlib Library
無重複字符的最長字符串(LeetCode 3)
机器学习之决策树
QML first day
K53. Chapter 2 installing kubernetes v1.22 based on binary packages -- cluster deployment
淘宝新改版商家如何操作,需要注意的点有哪些
JS to load and display Excel files
为什么新品发布上架之后会没有流量,新品应该怎么发布?
object.defineProperty 基本使用
[foundation of deep learning] back propagation method (1)
Decision tree of machine learning
IP地址管理
A.前缀极差
ARM processor mode and register









