返回 随机获取颜色... 登陆

随机获取颜色

Ai蓝胖子 2019-06-07 10:58:11 240

<div id="box" style="width:100px; height:100px; border:1px solid #000"></div>

<input id="rndc" type="button" value="随机变色"/>

<script>

function rc(){

   return parseInt(Math.random()*256);

}

$(function(){

   $("#rndc").click(function(){

      $("#box").css("background-color","rgb("+rc()+","+rc()+","+rc()+")");

   });

});

</script>


最新手记推荐

• 用composer安装thinkphp框架的步骤 • 省市区接口说明 • 用thinkphp,后台新增栏目 • 管理员添加编辑删除 • 管理员添加编辑删除

全部回复(0)我要回复

暂无评论~
  • 取消 回复 发送
  • PHP中文网