第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定

jquery實現(xiàn)抽獎系統(tǒng)

標簽:
JQuery

闲来无事做了一个抽奖的系统:

    

<!DOCTYPE html>

<html lang="en">

<head>

<meta charset="UTF-8">

<title>抽奖系统</title>

<script class="lazyload" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB/AAffA0nNPuCLAAAAAElFTkSuQmCC" data-original="source/jquery.js"></script>

<style>

#box{

width:450px;

margin:0 auto;

}

.show{

width:100px;

height:55px;

text-align:center;

background:#ff0;

line-height:55px;

border:1px solid #000;

border-radius:5px;

font-size:20px;

font-family:微软雅黑;

float:left;

margin:5px 5px 0px 5px;

}

#person{

width:450px;

height:100px;

background:#ff0;

text-align:center;

line-height:100px;

font-size:45px;

margin:0 auto;

margin-top:25px;

border:1px dotted #000;

font-family:楷体;

border-radius:10px;

}

p{

margin-top:25px;

text-align:center;

}

button{

width:65px;

height:35px;

text-align:center;

border:0px;

border-radius:5px;

background:#f36;

font-size:16px;

color:#fff;

cursor:pointer;

}

.active{

background:#f00;

}

</style>

</head>

<body>

<div id='box'>

<div class="show">吴泽辉</div>

<div class="show">李景亮</div>

<div class="show">李志伟</div>

<div class="show">潘雅静</div>

<div class="show">王建华</div>

<div class="show">高强</div>

<div class="show">秦英</div>

<div class="show">高文幸</div>

<div class="show">李雪</div>

<div class="show">高丹</div>

<div class="show">崔小刚</div>

<div class="show">赵艳萍</div>

<div class="show">于晓丽</div>

<div class="show">于洋</div>

<div class="show">胡小萌</div>

<div class="show">武渊</div>

</div>

<div ></div>

<div id="person">

获奖者

</div>

<p>

<button id="btn">开始</button>

</p>

</body>

<script>

var showlen=$('.show').length; //获取人员总数

var time=null; //初始化计时器


$('#btn').click(function(){

var flag=$(this).html();

flag=flag=='开始'?'停止':'开始'; //交换按钮上的内容

$(this).html(flag);


switch(flag)

{

case '停止': //这里是开始作抽奖

getIndex(0);

break;


case '开始': //这里是停止循环

getIndex(1);

$('#person').html('恭喜:'+$("#person").html()); //汇报结果

break;

}

});


function getIndex(mark)

{

if(mark==1)

{

clearInterval(time); //终止计时器

}

else

{

time=setInterval(show,1); //开启计时器

}


function show()

{

var idx=Math.floor(Math.random()*showlen); //生成随机数

for(var i=0;i<showlen;i++)

{

$('.show').eq(i).css({'background':'#ff0'}); //去掉所有的背景色

}

$('.show').eq(idx).css({'background':'#f00'});  //为当前选中的人加背景色

$("#person").html($('.show').eq(idx).html());  //将当前选中的人的名字显示在下面的框内

}

}

</script>

</html>



點擊查看更多內(nèi)容
TA 點贊

若覺得本文不錯,就分享一下吧!

評論

作者其他優(yōu)質(zhì)文章

正在加載中
  • 推薦
  • 評論
  • 收藏
  • 共同學習,寫下你的評論
感謝您的支持,我會繼續(xù)努力的~
掃碼打賞,你說多少就多少
贊賞金額會直接到老師賬戶
支付方式
打開微信掃一掃,即可進行掃碼打賞哦
今天注冊有機會得

100積分直接送

付費專欄免費學

大額優(yōu)惠券免費領

立即參與 放棄機會
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網(wǎng)微信公眾號

舉報

0/150
提交
取消