zoukankan      html  css  js  c++  java
  • 双色球随机数字

    <!DOCTYPE html>
    <html lang="en">
    <head>
    <meta charset="UTF-8">
    <title>Document</title>
    <link rel="stylesheet" type="text/css" href="css/qq.css">
    <script type="text/javascript">
    function getBall(){

    var reds=[parseInt(Math.random()*33+1)];

    while(reds.length<6){

    var r=parseInt(Math.random()*33+1);

    for(var i=0;i<reds.length;i++){
    if(reds[i]==r){
    break;
    }

    else if(i==reds.length-1){
    reds.push(r);
    }
    }
    }
    //排序
    function compare(a,b){return a-b};
    reds.sort(compare);
    for(var j=0;j<reds.length;j++){
    var ball=document.getElementById("ball"+j+"").innerHTML=reds[j];

    }
    document.getElementById("ball6").innerHTML=parseInt(Math.random()*16+1);
    }
    </script>
    </head>
    <body>
    <div id="ball0"></div>
    <div id="ball1"></div>
    <div id="ball2"></div>
    <div id="ball3"></div>
    <div id="ball4"></div>
    <div id="ball5"></div>
    <div id="ball6"></div>
    <button type="button" onclick="getBall()">双色球数字点点我就有!</button>
    </body>
    </html>

    css 部分

    *{
    margin: 0 auto;
    padding: 0px;
    }


    #ball0,#ball1,#ball2,#ball3,#ball4,#ball5 {
    50px;
    height: 50px;
    border-radius: 50%;
    border:2px solid red;
    display: inline-block;
    text-align: center;
    margin-top: 53px;
    line-height: 47px;

    }
    #ball6{
    50px;
    height:50px;
    border-radius: 50%;
    border:2px solid blue;
    display: inline-block;
    text-align: center;
    margin-top: 53px;
    line-height: 47px;

    }

    生命不断追求不止
  • 相关阅读:
    关于机器学习
    高级管理者和普通管理者区别
    一个kafka异常
    怎么读技术书
    Windows下查看什么进程占用文件
    关于Apache Phoenix和Cloudera结合
    bootstrap基础学习十一篇
    bootstrap基础学习十篇
    bootstrap基础学习九篇
    bootstrap基础学习八篇
  • 原文地址:https://www.cnblogs.com/tangtangsimida/p/7384581.html
Copyright © 2011-2022 走看看