-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscratchBox.html
More file actions
52 lines (32 loc) · 1.02 KB
/
scratchBox.html
File metadata and controls
52 lines (32 loc) · 1.02 KB
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
49
50
51
52
<html>
<head>
</head>
<body>
<script>
for(var i = 1 ; i<=15 ; i++){
var mainDiv = document.createElement("div");
document.body.appendChild(mainDiv);
mainDiv.setAttribute("id" , `div${i}`);
document.getElementById(`div${i}`).style.width = "100%";
document.getElementById(`div${i}`).style.height = "10%";
document.getElementById(`div${i}`).style.display = "flex";
document.getElementById(`div${i}`).style.backgroundColor = "red";
}
for(var j=1; j<=15 ; j++){
for(var k=1; k<=15 ; k++){
var childDiv = document.createElement("div");
document.getElementById(`div${j}`).appendChild(childDiv);
childDiv.setAttribute("id" , `childDiv${k}`);
childDiv.style.width = "10%";
childDiv.style.height = "100%";
var a = Math.floor(Math.random() * (250 - 1 + 1)) + 1;
var b = Math.floor(Math.random() * (250 - 1 + 1)) + 1;
var c = Math.floor(Math.random() * (250 - 1 + 1)) + 1;
childDiv.style.backgroundColor = `rgb(${a},${b},${c})`;
console.log(k);
}
console.log(j);
}
</script>
</body>
</html>