-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcolora molti div.html
67 lines (58 loc) · 1.66 KB
/
colora molti div.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
56
57
58
59
60
61
62
63
64
65
66
67
<!DOCTYPE html>
<html lang='en'>
<head>
<title>prova3</title>
<meta charset=utf-8 />
<style>
body {background-color:#272822; font-size:1.5em; color:#aaa; }
h3,p {color:#c00; border: 2px solid black;
padding:10px; background-color:#333530;
display:inline-block;position:relative; left:10%;}
div {width:90px; height:50px;
background-color:#444; border: 1px solid black;
padding:5px; }
/*#idCulo {background-color:#050;}*/
.classEl {background-color:#500;}
</style>
</head>
<body>
<h3>third try at the Project: Javascript/jQuery</h3>
<div class='classEl'>1</div>
<div class='classEl'>2</div>
<div class='classEl'>3</div>
<div class='classEl'>4</div>
<div class='classEl'>5</div>
<script>
var div = document.getElementsByClassName("classEl");
for(var i = 0; i < div.length; i++) {
div[i].onmouseover = function() {
this.style.backgroundColor = "green";
}
var myVar;
div[i].onmouseout = function() {
myVar=setTimeout(function (){
this.style.backgroundColor = "#500"; }, 500);
}
}
/*var div = document.getElementsByClassName("classEl"); //BACKUP
for(var i = 0; i < div.length; i++) {
div[i].onmouseover = function() {
this.style.backgroundColor = "green";
}
div[i].onmouseout = function() {
this.style.backgroundColor = "#500";
}
}
/*var div = document.getElementsByClassName("classEl"); //BACKUP2
for(var i = 0; i < div.length; i++) {
div[i].onmouseover = function() {
this.style.backgroundColor = "green";
}
div[i].onmouseout = function() {
this.style.backgroundColor = "#500";
}
}
*/
</script>
</body>
</html>