-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path026 sporloto.html
48 lines (44 loc) · 1.57 KB
/
026 sporloto.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
.sekil{
width: 30px;
height: 30px;
float:left;
text-align: center;
margin:10px;
padding: 15px;
color:#FFF;
border:1px solid grey;
font-size:20px;
}
</style>
</head>
<body onload="rastgeleUret()">
<button onclick="rastgeleUret()">Rastgele Sayı Üret</button> <br>
<div id="kutu1" class="sekil"></div>
<div id="kutu2" class="sekil"></div>
<div id="kutu3" class="sekil"></div>
<div id="kutu4" class="sekil"></div>
<div id="kutu5" class="sekil"></div>
<div id="kutu6" class="sekil"></div>
<script>
function rastgeleUret(){
// var kutular = document.querySelectorAll("[id^=kutu]"); /* div id içinde kutu geçenleri al */
for (var i=1; i<=6; i++){
rastgele=Math.floor(Math.random(1)*49+1);/* 1-49 arası sayı */
red=Math.floor(Math.random(1)*256); /* 0-255 arası üretir */
green=Math.floor(Math.random(1)*256);
blue=Math.floor(Math.random(1)*256);
document.getElementById('kutu'+i).innerHTML=rastgele;
document.getElementById("kutu"+i).style.backgroundColor= 'rgb('+red+','+green+','+blue+')';
//kutular[i-1].innerHTML= rastgele;
}
}
</script>
</body>
</html>