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">
<title>随机点名title>
<style>
*{
padding: 0;
margin: 0;
background-color: #414141;
}
div{
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%,-50%);
text-align: center;
}
span,h2{
text-shadow: 0 0 10px #dfd8d8;
background: linear-gradient(135deg,#14ffe9,#ffeb3b,#ff00e0);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
animation: ff 0.9s linear infinite;
}
@keyframes ff{
to{filter: hue-rotate(360deg);}
}
h2{
font-size: 72px;
}
span{
font-size: 46px;
}
button{
position: absolute;
top: 60%;
left: 50%;
transform: translate(-50%,-50%);
width: 80px;
height: 25px;
box-shadow: 0 0 10px #fff;
outline: none;
background-color: gray;
}
style>
head>
<body>
<div>
<h2>随机点名h2>
<span id="name">span>
div>
<button id="button_text">stopbutton>
<script>
let nametxt=document.getElementById('name');
let button=document.getElementById('button_text');
let uname=['阿阳热爱前端','郝嘉慧','冬灰条','蒸羊羔儿','蒸熊掌','蒸鹿尾儿',
'烧花鸭','烧雏鸡','烧子鹅','炉猪','炉鸭','酱鸡','腊肉','松花',
'小肚儿','晾肉','香肠儿','什锦苏盘儿','熏鸡白肚儿','清蒸八宝猪',
'江米酿鸭子','罐儿野鸡','罐儿鹌鹑','卤什件儿','卤子鹅','山鸡','兔脯',
'菜蟒','银鱼','清蒸哈什蚂','烩鸭腰儿','鸭条','清拌腰丝儿','黄心管儿'];
function getrandom(min,max){
return Math.floor(Math.random()*(max-min-1)+min);
}
function clock(){
let random=uname[getrandom(0,uname.length-1)];
nametxt.innerHTML=random;
};
let time=self.setInterval("clock()",30);
let flag=false;
button.onclick=function(){
if(flag==false)
{
time=window.clearInterval(time);
button.innerHTML='start';
flag=true;
}else{
time=self.setInterval("clock()",30);
button.innerHTML='stop';
flag=false;
}
}
script>
body>
html>

- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 73
- 74
- 75
- 76
- 77
- 78
- 79
- 80
- 81
- 82
- 83
- 84
- 85
- 86
- 87
- 88
- 89
- 90
- 91
- 92
- 93
- 94
- 95
- 96
- 97
- 98
- 99
- 100
- 101
- 102
- 103
- 104
- 105
- 106
- 107
- 108
- 109
- 110