栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > Web开发 > JavaScript

js实现随机抽选效果、随机抽选红色球效果

JavaScript 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

js实现随机抽选效果、随机抽选红色球效果




  
  caipiao


  
  
  
  


随机抽选




  
  caipiao
  
    * {
      margin:0;
      padding: 0;
    }
    #wrap {
      width:621px;
      margin:0 auto;
      padding:50px 0;
      background-color:rgb(255, 242, 242);
    }
    #inner {
      width:490px;
      margin:0 auto;
      overflow: hidden;
    }
    #inner span {
      float: left;
      width:30px;
      height: 30px; 
      border-radius: 15px;
      border:1px solid #d9d9d9;
      line-height: 30px;
      text-align: center;
      color:#333;
      background-color: #f8f8f8;
      margin:18px 6px;
    }
    #inner span.active {
      background-color: red;
      color:#fff;
    }
    #wrap p {
      text-align: center;
    }
    button {
      border:none;
      outline: none;
      width:120px;
      height: 40px;
      line-height: 40px;
      font-size: 20px;
      border-radius: 4px;
    }
    #selectBtn {
      background-color: red;
      color:#fff;
    }
  


  
    
      01
      02
      03
      04
      05
      06
      07
      08
      09
      10
      11
      12
      13
      14
      15
      16
      17
      18
      19
      20
      21
      22
      23
      24
      25
      26
      27
      28
      29
      30
      31
      32
      33
    
    

要实现点击得到自动随机数还得在clearBtn.onclick前面添加个定时器

var timer = 0;
  selectBtn.onclick = function() {
    clearTimeout(timer);
    timer = setInterval(selectBall,100);
    setTimeout(function() {
      clearTimeout(timer);
    },3000)
    // clearTimeout(timer);
  }

这样就实现了动态图的功能了(*^__^*) 嘻嘻!

以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,同时也希望多多支持考高分网!

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/90884.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号