首页
IT
登录
6mi
u
盘
搜
搜 索
IT
JavaScript随机抽奖
JavaScript随机抽奖
xiaoxiao
2021-12-14
23
<!DOCTYPE
html
> <
html
> <
head
lang=
"en"
> <
meta
charset=
"UTF-8"
> <
title
>
随机抽奖
</
title
> <
style
> .
box
{
width
:
600
px
;
height
:
500
px
;
margin
:
0
auto
;
border
:
dashed
#ccc
2
px
;}
button
{
width
:
120
px
;
height
:
40
px
;
border-radius
:
10
px
;
margin
:
30
px auto
;
font-size
:
26
px
;
display
:
block
;}
span
{
width
:
300
px
;
height
:
300
px
;
background
:
#ffff99
;
display
:
block
;
margin
:
0
auto
;
border-radius
:
100
%
;
text-align
:
center
;
font-size
:
30
px
;
line-height
:
300
px
;} </
style
> <
script
>
var
a1
=
[
"
林惊羽
"
,
"
曾书书
"
,
"
碧瑶
"
,
"
张小凡
"
,
"
无崖子
"
,
"
鬼王
"
];
var
times
;
function
star
(){
var
index
=
parseInt
(Math.
random
()
*
a1
.length);
var
x
=
a1
[
index
];
var
s
=
document.
getElementById
(
"show"
);
s
.innerHTML
=
x
; }
function
start
(){
times
=
setInterval
(
star
,
40
); }
function
end
(){
clearInterval
(
times
); } </
script
> </
head
> <
body
> <
div
class=
"box"
> <
span
id=
"show"
>
等待抽奖
</
span
> <
button
οnclick=
"
start
()
"
>
开始抽奖
</
button
> <
button
οnclick=
"
end
()
"
>
结束抽奖
</
button
> </
div
> </
body
> </
html
>
转载请注明原文地址: https://ju.6miu.com/read-971010.html
专利
最新回复
(
0
)