亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

做了一個 隨機變化顏色

original 2019-03-27 17:32:26 175
abstrait:<!DOCTYPE html><html> <head>  <meta charset="UTF-8">  <title> divbackground </title>    <style>  div{width:100px;

<!DOCTYPE html>

<html>

 <head>

  <meta charset="UTF-8">

  <title> divbackground </title>  

  <style>

  div{width:100px;height:200px;margin:0px auto;border:1px solid red;}


  </style>

 </head>



 <body>

  <div id="d1"></div>

 </body>

<script>

var d1= document.getElementById("d1");

function foo(){

var arr=[0,1,2,3,4,5,6,7,8,9,"a","b","c","d","e","f"]

var color = "#"+arr[Math.floor(Math.random()*arr.length)]+arr[Math.floor(Math.random()*arr.length)]+arr[Math.floor(Math.random()*arr.length)]+arr[Math.floor(Math.random()*arr.length)]+arr[Math.floor(Math.random()*arr.length)]+arr[Math.floor(Math.random()*arr.length)];


d1.style.background = color;



}


var t = setInterval(foo,500);

</script>

//用到了隨機數(shù)字

</html>


Professeur correcteur:天蓬老師Temps de correction:2019-03-28 10:22:27
Résumé du professeur:只要能打亂RGB中的數(shù)值, 就可以實現(xiàn)隨機變化 , 要注意變化 的范圍就可以了

Notes de version

Entrées populaires