您当前所在位置:
首页 方法技巧 用javascript随机数原理实现的一个彩票预测程序

用javascript随机数原理实现的一个彩票预测程序

许启 6321 2016-04-17 11:41

用javascript随机数原理实现的一个彩票预测程序,看看谁帮忙转换成excel代码谢谢



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />

<title>中国体育彩票预测-jquery中文网-www.jquerycn.cn</title>

<style type="text/css">

  #main{

   width:500px;

   height:600px;

   margin:auto;

   border:0px solid #000;

  }

</style>

</head>

<body onload="ob(),setNum(),setInterval('timer()',100);setInterval('runClock()',100);">

<!--setInterval()每隔多少时间就自动调用函数、方法或对象-->

<!--时钟部分开始-->

  <script type="text/javascript">

     pX=450;pY=90;

     obs = new Array(13)

     function ob () {

      for (i=0; i<=12; i++) {

       if (document.all) obs=new Array (('ob'+i).style,-100,-100)

       else obs = new Array (('document.ob'+i),-100,-100)

       }

      }

     function cl(a,b,c){

      if (document.all) {

       if (a!=0) b+=-1

       ('c'+a+'.style.pixelTop='+(pY+(c)))

       ('c'+a+'.style.pixelLeft='+(pX+(b)))

       }

      else{

       if (a!=0) b+=10

       ('document.c'+a+'.top='+(pY+(c)))

       ('document.c'+a+'.left='+(pX+(b)))

      }

      if (document.all) c0.style.pixelLeft=26

      }

   

      function runClock() {

       for (i=0; i<13; i++) {

        obs[0].left=obs[1]+pX

        obs[0].top=obs[2]+pY

       }

      }

   

      var lastsec

      function timer() {

       time = new Date ()

       sec = time.getSeconds()

       if (sec!=lastsec) {

      

        lastsec = sec

        sec=Math.PI*sec/30

        min=Math.PI*time.getMinutes()/30

        hr =Math.PI*((time.getHours()*60)+time.getMinutes())/360

        for (i=1;i<6;i++) {

         obs[1] = Math.sin(sec) * (44 - (i-1)*11)-16;

         if (document.layers)obs[1]+=10;

         obs[2] = -Math.cos(sec) * (44 - (i-1)*11)-27;

        }

        for (i=6;i<10;i++) {

         obs[1] = Math.sin(min) * (40 - (i-6)*10)-16;

         if (document.layers)obs[1]+=10;

         obs[2] = -Math.cos(min) * (40 - (i-6)*10)-27;

        }

        for (i=10;i<13;i++) {

         obs[1] = Math.sin(hr) * (37 - (i-10)*11)-16;

         if (document.layers)obs[1]+=10;

         obs[2] = -Math.cos(hr) * (37 - (i-10)*11)-27;

        }

       }

      

      }

      function setNum(){

      

      cl (0,-67,-65);

      cl (1,10,-51);

      cl (2,28,-33);

      cl (3,35,-8);

      cl (4,28,17);

      cl (5,10,35);

      cl (6,-15,42);

      cl (7,-40,35);

      cl (8,-58,17);

      cl (9,-65,-8);

      cl (10,-58,-33);

      cl (11,-40,-51);

      cl (12,-16,-56);

     }

    </script>   

   <!--刻度尺开始-->

   <!--刻度尺开始-->

   <div id="c0" style="position: absolute; right: 6px; top: 6; z-index: 2; left: 4; width: 536; height: 19"></div>

   

   <div id="c1" style="FONT-SIZE: 11px; LEFT: 20px; POSITION: absolute; TOP: -20px; Z-INDEX: 5"><b>

    <p>1</p></b>

   </div>

   

   <div id="c2" style="FONT-SIZE: 11px; LEFT: 20px; POSITION: absolute; TOP: -20px; Z-INDEX: 5"><b>

    <p>2</p></b>

   </div>

   

   <div id="c3" style="FONT-SIZE: 11px; LEFT: 20px; POSITION: absolute; TOP: -20px; Z-INDEX: 5"><b>

    <p>3</p></b>

   </div>

   

   <div id="c4" style="FONT-SIZE: 11px; LEFT: 20px; POSITION: absolute; TOP: -20px; Z-INDEX: 5"><b>

   <p>4</p></b>

   </div>

   

   <div id="c5" style="FONT-SIZE: 11px; LEFT: 20px; POSITION: absolute; TOP: -20px; Z-INDEX: 5"><b>

    <p>5</p></b>

   </div>

   

   <div id="c6" style="FONT-SIZE: 11px; LEFT: 20px; POSITION: absolute; TOP: -20px; Z-INDEX: 5"><b>

    <p>6</p></b>

   </div>

   

   <div id="c7" style="FONT-SIZE: 11px; LEFT: 20px; POSITION: absolute; TOP: -20px; Z-INDEX: 5"><b>

    <p>7</p></b>

   </div>

   

   <div id="c8" style="FONT-SIZE: 11px; LEFT: 20px; POSITION: absolute; TOP: -20px; Z-INDEX: 5"><b>

    <p>8</p></b>

   </div>

   

   <div id="c9" style="FONT-SIZE: 11px; LEFT: 20px; POSITION: absolute; TOP: -20px; Z-INDEX: 5"><b>

   <p>9</p></b>

   </div>

   

   <div id="c10" style="FONT-SIZE: 11px; LEFT: 20px; POSITION: absolute; TOP: -20px; Z-INDEX: 5"><b>

    <p>10</p></b>

   </div>

   

   <div id="c11" style="FONT-SIZE: 11px; LEFT: 20px; POSITION: absolute; TOP: -20px; Z-INDEX: 5"><b>

    <p>11</p></b>

   </div>

   

   <div id="c12" style="FONT-SIZE: 11px; LEFT: 20px; POSITION: absolute; TOP: -20px; Z-INDEX: 5"><b>

    <p>12</p></b>

   </div>

   <!--刻度尺结束-->

   <!--刻度尺结束-->

   

   <!--指针构造点开始-->

   <!--指针构造点开始-->

   

   <div id="ob0" style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 1"></div>

   

   <div id="ob1" style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 8">

    <font color="#0000ff" size="+3">

    <b><p>.</b>

   </div>

   

   <div id="ob2" style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 8">

    <font color="#0000ff" size="+3">

     <b><p>.</p></b>

    </font>

   </div>

   

   <div id="ob3" style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 8">

    <font color="#0000ff" size="+3">

     <b><p>.</p></b>

    </font>

   </div>

   

   <div id="ob4" style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 8">

    <font color="#0000ff" size="+3">

     <b><p>.</p></b>

    </font>

   </div>

   

   <div id="ob5" style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 8">

    <font color="#0000ff" size="+3">

     <b><p>.</p></b>

    </font>

   </div>

   

   <div id="ob6" style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 7">

    <font color="#00ffff" size="+3">

     <b><p>.</p></b>

    </font>

   </div>

   

   <div id="ob7" style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 7">

    <font color="#00ffff" size="+3">

     <b><p>.</p></b>

    </font>

   </div>

   

   <div id="ob8" style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 7">

    <font color="#00ffff" size="+3">

     <b><p>.</p></b>

    </font>

   </div>

   

   <div id="ob9" style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 7">

    <font color="#00ffff" size="+3">

     <b><p>.</p></b>

    </font>

   </div>

   

   <div id="ob10" style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 6">

    <font color="#f30000" size="+3">

     <b><p>.</p></b>

    </font>

   </div>

   

   <div id="ob11" style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 6">

    <font color="#f30000" size="+3">

     <b><p>.</p></b>

    </font>

   </div>

   

   <div id="ob12" style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 6">

    <font color="#f30000" size="+3">

     <b><p>.</p></b>

    </font>

   </div>

   <!--指针构造点结束-->

   <!--指针构造点结束-->

  <!--时钟部分结束-->

  <!--时钟部分结束-->

<div id="main" align="center">

   <span style="color: #339900; font-size:18px; font:bolder ">

   <script type="text/javascript">

   //alert('hello!');

     var date=new Date();

      document.write(date.getYear()+"年"+(date.getMonth()+1)+"月"+date.getDate()+

     '日&nbsp;'+date.getHours()+"时"+date.getMinutes()+"分"+date.getSeconds()+"秒");

   </script>

   </span>

  <div style="font-size:16px;">获取7位随机数:

   <span style="color: #FFFFFF; font-size:20px; background:#000099 ">

  <script type="text/javascript">

   for (var i=0;i<7;i++){

    var count=Math.floor(Math.random()*10);

    document.write(" "+count);

   }

  </script>

   </span>

  </div>

   <div style="font-size:16px;">

    <script type="text/javascript">

    function sum(a){

     var num1=document.getElementByIdx('num1').value;

     var num2=document.getElementByIdx('num2').value;

     var sum=num1+ a +num2;

     //alert((sum));

     document.getElementByIdx('num3').value=(sum);

     }

    </script>

    <br />

    <label style="font-size:16px;">简单计算器,请输入两个数:</label><br />

    参数1:<input type="text" id="num1" /><br />

    参数2:<input type="text" id="num2" /><br />

    &nbsp&nbsp值:<input type="text" id="num3" /><br />

    <input type="button" value="+" onclick="sum('+')"/>

    <input type="button" value="-" onclick="sum('-')"/>

    <input type="button" value="x" onclick="sum('*')"/>

    <input type="button" value="/" onclick="sum('/')"/>

    <br />

   </div>

    <div style=" float:center; margin-top:330px; font-size:16px;">彩市有风险,购彩要谨慎。<br/>

    此测试程序,由jquery中文网,搜集整理,仅供学习参考。</div>

</div>

</body>

</html>