Blogger Information
Blog 35
fans 0
comment 0
visits 27398
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
双色球开奖演示
小的博客
Original
572 people have browsed it

下面是代码的运行效果;当点击刷新的事件数字都会随机改变;

QQ截图20180108135708.png

<?php
 header('Content-Type:text/html;charset=utf-8');
 require 'header.php';
 echo '<script>
 //JavaScript 的点击刷新事件,涉及reload();
  function show(){
 location.reload();
  }
 </script>';
 $red_ball=range(1,33);
 $temp=array_rand($red_ball,6);
  shuffle($temp);//打乱顺序
  //在单位球前面加前导零
  foreach($temp as $i){
   $red[]= $red_ball[$i]<10?'0'.$red_ball[$i]:$red_ball[$i];
  }
  $blue_ball=mt_rand(1,16);
  $blue=$blue_ball<10?'0'.$blue_ball:$blue_ball;
 foreach($red as $value){
  echo '<div style="text-align:center;line-height:40px;background:red;width:40px;height:40px;border-radius:20px;float:left;"><span style="color:white;">'.$value.'</span></div>&nbsp;&nbsp;&nbsp;';
 }
      echo '<div style="text-align:center;line-height:40px;background:skyblue;width:40px;height:40px;border-radius:20px;float:left;">'.$blue.'</div>';
      //添加一个按钮绑定一个点击刷新时间
   echo '<button style="position:absolute;top:100px;left:40px;width:180px;height:35px;background:skyblue;border-radius:17px;" onclick=show()>刷新</button>';
?>


Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post