-
Notifications
You must be signed in to change notification settings - Fork 0
/
newcode.html
55 lines (50 loc) · 1.46 KB
/
newcode.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
49
50
51
52
53
54
55
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>NLP New Code</title>
<script src="//code.jquery.com/jquery-latest.min.js"></script>
<style>
html, body {
margin: 0;
width: 100%;
height: 100%;
}
div {
width: 3em;
height: 1.5em;
text-align: center;
font-size: 3em;
font-weight: bold;
float: right;
}
</style>
<script>
$(document).ready(function () {
var b = $(document.body);
b.append($('<div></div>').text('כחול').css('color', 'blue'));
b.append($('<div></div>').text('ירוק').css('color', 'green'));
b.append($('<div></div>').text('אדום').css('color', 'red'));
var t, c = '';
for (var i = 0; i < 200; i++) {
c = clr(c);
t = txt(c);
b.append($('<div></div>').text(t).css('color', c));
}
});
function clr(color) {
var colors = ['red', 'green', 'blue'];
var c = colors[Math.floor(Math.random() * 3)];
if (c == color && Math.random() > 0.2) return clr(color);
return c;
}
function txt(color) {
var c = clr(color);
var name = {red: 'אדום', green: 'ירוק', blue: 'כחול'};
return name[c];
}
</script>
</head>
<body>
</body>
</html>