forked from Ambrine/mosaic
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
44 lines (37 loc) · 1.05 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
42
43
44
<!DOCTYPE html>
<html>
<head>
<title>Mosaic</title>
<link rel="stylesheet" type="text/css" href="./style.css" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
</head>
<body>
<header>
<h1>Mosaic</h1>
</header>
<div id="layout">
</div>
<script type="text/javascript">
function randomColor() {
var r = Math.floor((Math.random() * 255));
var g = Math.floor((Math.random() * 255));
var b = Math.floor((Math.random() * 255));
return 'rgb('+r+','+g+','+b+')';
}
$(document).ready(function() {
var $grid = $('<table></table>');
var rows = 10;
var cols = 30;
for (var i = 0; i < rows; i++) {
var $row = $('<tr></tr>');
for (var j =0; j < cols; j++) {
var $col = $('<td style="background:'+randomColor()+';"></td>');
$row.append($col);
}
$grid.append($row);
}
$('#layout').append($grid);
});
</script>
</body>
</html>