随机获取颜色

原创 2019-06-07 10:58:11 242
摘要:<div id="box" style="width:100px; height:100px; border:1px solid #000"></div><input id="rndc" type="button&quo

<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>


批改老师:查无此人批改时间:2019-06-10 09:39:03
老师总结:完成的还不错。作业要加上自己对功能的理解。继续加油。

发布手记

热门词条