-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
41 lines (35 loc) · 1.32 KB
/
index.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
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8" http-equiv="refresh" content="1">
<script type="text/javascript">
function show_pattern(){
var top_position = 25, left_position = 25;
var height = 500, width = 500;
var color_list = ["red", "blue", "orange", "yellow"];
var body = document.getElementById("theBody");
body.style.position = "absolute";
while (width > 50){
var random_color = Math.random() * 7;
random_color = Math.floor(random_color);
random_color = color_list[random_color];
var this_div = document.createElement("div");
this_div.style.position = "fixed";
this_div.style.top = top_position + "px";
this_div.style.left = left_position + "px";
this_div.style.height = height + "px";
this_div.style.width = width + "px";
this_div.style.background = random_color;
body.appendChild(this_div);
top_position += 10;
left_position += 10;
height -= 20;
width -= 20;
}
}
</script>
<title>Jquery Example</title>
</head>
<body id="theBody" onload="show_pattern()">
</body>
</html>